not_filt = fes.Not([fes.PropertyIsLike(propertyname='apiso:AnyText', literal=('*%s*' % val), escapeChar='\\', wildCard='*', singleChar='?')]) filter_list = [fes.And([ bbox, start, stop, or_filt, not_filt]) ] # connect to CSW, explore it's properties # try request using multiple filters "and" syntax: [[filter1,filter2]] csw.getrecords2(constraints=filter_list, maxrecords=1000, esn='full') print str(len(csw.records)) + " csw records found" for rec, item in csw.records.items(): print(item.title) # <codecell> dap_urls = service_urls(csw.records) #remove duplicates and organize dap_urls = sorted(set(dap_urls)) print "Total DAP:",len(dap_urls) #print the first 5... print "\n".join(dap_urls[:]) # <codecell> sos_urls = service_urls(csw.records,service='sos:url') #remove duplicates and organize sos_urls = sorted(set(sos_urls)) print "Total SOS:",len(sos_urls) print "\n".join(sos_urls) # <codecell>
]) filter_list = [fes.And([bbox, start, stop, or_filt, not_filt])] # connect to CSW, explore it's properties # try request using multiple filters "and" syntax: [[filter1,filter2]] csw.getrecords2(constraints=filter_list, maxrecords=1000, esn='full') print str(len(csw.records)) + " csw records found" for rec, item in csw.records.items(): print(item.title) # <markdowncell> # #### List end points available # <codecell> dap_urls = service_urls(csw.records) #remove duplicates and organize dap_urls = sorted(set(dap_urls)) print "Total DAP:", len(dap_urls) #print the first 5... print "\n".join(dap_urls[:]) # <codecell> sos_urls = service_urls(csw.records, service='sos:url') #remove duplicates and organize sos_urls = sorted(set(sos_urls)) print "Total SOS:", len(sos_urls) print "\n".join(sos_urls) # <codecell>
endpoint = "http://www.ngdc.noaa.gov/geoportal/csw" csw = CatalogueServiceWeb(endpoint, timeout=60) csw.getrecords2(constraints=filter_list, maxrecords=1000, esn="full") fmt = "{:*^64}".format log.info(fmt(" Catalog information ")) log.info("URL: {}".format(endpoint)) log.info("CSW version: {}".format(csw.version)) log.info("Number of datasets available: {}".format(len(csw.records.keys()))) # In[5]: from utilities import service_urls dap_urls = service_urls(csw.records, service="odp:url") sos_urls = service_urls(csw.records, service="sos:url") log.info(fmt(" CSW ")) for rec, item in csw.records.items(): log.info("{}".format(item.title)) log.info(fmt(" SOS ")) for url in sos_urls: log.info("{}".format(url)) log.info(fmt(" DAP ")) for url in dap_urls: log.info("{}.html".format(url))