def _fetch_online_data(self): ''' Return list of GCMD standard keywords self.url and self.categories must be set ''' response = openURL(self.url) gcmd_list = [] _read_revision(response.readline(), gcmd_list) _check_categories(response.readline(), self.categories) for line in response.readlines(): _read_line(line, gcmd_list, self.categories) return gcmd_list
def _fetch_online_data(self): # Note the version number... Would probably be better to make it always # take the last version.. u1 = openURL(self.url) dom = parse(u1) # should only contain the standard_name_table: node = dom.childNodes[0] cf_list = [] for entry in node.getElementsByTagName('entry'): standard_name = entry.attributes['id'].value units = '' if entry.getElementsByTagName( 'canonical_units')[0].childNodes: units = entry.getElementsByTagName( 'canonical_units')[0].childNodes[0].nodeValue grib = '' if entry.getElementsByTagName('grib')[0].childNodes: grib = entry.getElementsByTagName( 'grib')[0].childNodes[0].nodeValue amip = '' if entry.getElementsByTagName('amip')[0].childNodes: amip = entry.getElementsByTagName( 'amip')[0].childNodes[0].nodeValue if entry.getElementsByTagName('description')[0].childNodes: descr = entry.getElementsByTagName( 'description')[0].childNodes[0].nodeValue stdname = { 'standard_name': standard_name, 'canonical_units': units, 'grib': grib, 'amip': amip, 'description': descr } cf_list.append(stdname) return cf_list
def _fetch_online_data(self): ''' Return list of Well Known Variables from Nansat ''' response = openURL(self.url) return yaml.load(response.read())