From 151f1988a16d4fb58134320106b7712105083681 Mon Sep 17 00:00:00 2001 From: Rob tB Date: Thu, 8 May 2014 14:54:30 +0200 Subject: [PATCH] added function to scrape table for Antoine equation parameters --- FourmiCrawler/sources/NIST.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FourmiCrawler/sources/NIST.py b/FourmiCrawler/sources/NIST.py index 5757546..aba0ec2 100644 --- a/FourmiCrawler/sources/NIST.py +++ b/FourmiCrawler/sources/NIST.py @@ -43,6 +43,8 @@ class NIST(Source): 'Antoine Equation Parameters'): log.msg('NIST table: Antoine Equation Parameters', level=log.DEBUG) + requests.extend( + self.parse_antoine_data(tables)) elif len(tables.xpath('tr[1]/th')) == 5: log.msg('NIST table: generic 5 columns', level=log.DEBUG) # Symbol (unit) Temperature (K) Method Reference Comment @@ -118,6 +120,25 @@ class NIST(Source): results.append(result) return results + @staticmethod + def parse_antoine_data(table): + results = [] + + name = table.xpath('@summary').extract()[0] + + for tr in table.xpath('tr[td]'): + tds = tr.xpath('td/text()').extract() + result = Result({ + 'attribute': name, + 'value': 'A=%s, B=%s, C=%s' % (tds[1], tds[2], tds[3]), + 'source': 'NIST', + 'reliability': 'Unknown', + 'conditions': '%s K' % tds[0] + }) + results.append(result) + + return results + def new_compound_request(self, compound): return Request(url=self.website[:-1] + self.search % compound, callback=self.parse)