In [1]:
#massimo's version
from owslib.csw import CatalogueServiceWeb
In [2]:
endpoint = 'http://www.nodc.noaa.gov/geoportal/csw'
bbox = [-71.5, 39.5, -63.0, 46]
keywords = ['temperature']
maxrecords = 20
service_type = 'opendap'
def getResource(endpoint = 'http://www.nodc.noaa.gov/geoportal/csw', bbox=None, keywords=None, maxrecords=1, service_type='opendap', verbose=None):
if service_type == 'opendap':
service_string='urn:x-esri:specification:ServiceType:OPeNDAP'
if service_type == 'wms':
service_string='urn:x-esri:specification:ServiceType:WMS'
csw = CatalogueServiceWeb(endpoint,timeout=30)
if keywords is not None:
csw.getrecords(keywords=keywords, bbox=bbox, maxrecords=maxrecords)
else :
csw.getrecords(bbox=bbox, maxrecords=maxrecords)
csw.records.keys()
result = {}
for i in csw.records.keys():
records=csw.records[i]
resource = {}
for key,rec in csw.records.iteritems():
url = next((d['url'] for d in rec.references if d['scheme'] == service_string), None)
if url is not None:
resource[rec.title] = url
result[i] = resource
if verbose is not None:
print 'endpoint: ', endpoint, '\n' , 'bbox: ', bbox, '\n' , 'keywords: ', keywords, '\n', 'maxrecords: ', maxrecords , '\n', 'service_type: ' , service_type
return result
In [3]:
res = getResource(endpoint=endpoint, bbox=bbox, keywords=keywords, maxrecords=maxrecords, verbose=True)
endpoint: http://www.nodc.noaa.gov/geoportal/csw
bbox: [-71.5, 39.5, -63.0, 46]
keywords: ['temperature']
maxrecords: 20
service_type: opendap
In [4]:
print res.keys()
['PSDgriddedData/cru/crutem4/var/air.mon.anom.nc', 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.biased2.5.nc', 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.mserror.nc', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.samplingerror.nc', 'ghrsst.cfg.aggregation.fullAgg.aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.nc', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.nc', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.stationerror.nc', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.biased97.5.nc', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.biased2.5.nc', 'satellite.G1.ssta.1day', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.nobs.nc', 'HadleyCenter.HadISST', 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.biased97.5.nc', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.biased97.5.nc', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.biased2.5.nc', 'PSDgriddedData/cru/crutem4/std/air.mon.anom.samplingerror.nc', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.stationerror.nc', 'satellite.GR.ssta.1day', 'PSDgriddedData/cru/crutem3/std/air.mon.anom.nobs.nc']
In [5]:
print res
{'PSDgriddedData/cru/crutem4/var/air.mon.anom.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.biased2.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.mserror.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.samplingerror.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'ghrsst.cfg.aggregation.fullAgg.aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.stationerror.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.biased97.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.biased2.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'satellite.G1.ssta.1day': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.nobs.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'HadleyCenter.HadISST': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/hadcrut3/std/air.mon.anom.biased97.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.biased97.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.biased2.5.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem4/std/air.mon.anom.samplingerror.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.stationerror.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'satellite.GR.ssta.1day': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}, 'PSDgriddedData/cru/crutem3/std/air.mon.anom.nobs.nc': {'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}}
In [6]:
print res[res.keys()[0]]
{'Analysed foundation sea surface temperature, global': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/satellite/GR/ssta/1day', 'Monthly version of HadISST sea surface temperature component': 'http://oceanwatch.pfeg.noaa.gov/thredds/dodsC/HadleyCenter/HadISST', 'Global Sea Surface Temperature Analysis': 'http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/cfg/aggregation/fullAgg/aggregate__ghrsst_L4_GLOB_EUR_ODYSSEA.ncml', 'CRUTEM3 Air Temperature Anomaly': 'http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/cru/crutem3/std/air.mon.anom.nobs.nc'}
In [ ]:
Content source: rsignell-usgs/ipython-notebooks
Similar notebooks: