log.info('{}.html'.format(url)) log.info(fmt(' SOS URLs ')) for url in sos_urls: log.info('{}'.format(url)) # In[ ]: from pyoos.collectors.coops.coops_sos import CoopsSos collector = CoopsSos() sos_name = 'water_surface_height_above_reference_datum' datum = 'NAVD' collector.set_datum(datum) collector.end_time = stop collector.start_time = start collector.variables = [sos_name] ofrs = collector.server.offerings title = collector.server.identification.title log.info(fmt(' Collector offerings ')) log.info('{}: {} offerings'.format(title, len(ofrs))) # In[ ]: from pandas import read_csv from utilities import sos_request
# <codecell> sos_urls = service_urls(csw.records, service='sos:url') print("\n".join(sos_urls)) # <markdowncell> # ## 1. Get observations from SOS # Here we are using a custom class from pyoos to read the CO-OPS SOS. This is definitely unsavory, as the whole point of using a standard is avoid the need for custom classes for each service. Need to examine the consequences of removing this and just going with straight SOS service using OWSLib. # <codecell> collector = CoopsSos() collector.set_datum('NAVD') # MSL collector.server.identification.title collector.start_time = jd_start collector.end_time = jd_stop collector.variables = [sos_name] # <codecell> ofrs = collector.server.offerings print(len(ofrs)) for p in ofrs[700:710]: print(p) # <markdowncell> # ### Find the SOS stations within our bounding box and time extent
# ### SOS Requirements # #### Use Pyoos SOS collector to obtain Observation data from COOPS. # <codecell> start_time = datetime.strptime(start_date, '%Y-%m-%d %H:%M') end_time = datetime.strptime(end_date, '%Y-%m-%d %H:%M') # <codecell> iso_start = start_time.strftime('%Y-%m-%dT%H:%M:%SZ') iso_end = end_time.strftime('%Y-%m-%dT%H:%M:%SZ') collector = CoopsSos() collector.set_datum('NAVD') collector.server.identification.title collector.start_time = start_time collector.end_time = end_time collector.variables = [data_dict["water"]["sos_name"]] # <codecell> print("Date: %s to %s" % (iso_start, iso_end)) box_str = ','.join(str(e) for e in box) print("Lat/Lon Box: %s" % box_str) # <codecell> # Grab the sos url and use it for the service. url = (sos_urls[0].split("?")[0] + '?'
# ### SOS Requirements # #### Use Pyoos SOS collector to obtain Observation data from COOPS. # <codecell> start_time = datetime.strptime(start_date, '%Y-%m-%d %H:%M') end_time = datetime.strptime(end_date, '%Y-%m-%d %H:%M') # <codecell> iso_start = start_time.strftime('%Y-%m-%dT%H:%M:%SZ') iso_end = end_time.strftime('%Y-%m-%dT%H:%M:%SZ') collector = CoopsSos() collector.set_datum('NAVD') collector.server.identification.title collector.start_time = start_time collector.end_time = end_time collector.variables = [data_dict["water"]["sos_name"]] # <codecell> print("Date: %s to %s" % (iso_start, iso_end)) box_str = ','.join(str(e) for e in box) print("Lat/Lon Box: %s" % box_str) # <codecell> # Grab the opendap sos url and use it for the service. for sos_url in sos_urls:
for url in dap_urls: log.info('{}.html'.format(url)) log.info(fmt(' SOS ')) for url in sos_urls: log.info('{}'.format(url)) # In[9]: from pyoos.collectors.coops.coops_sos import CoopsSos collector = CoopsSos() sos_name = 'water_surface_height_above_reference_datum' datum = 'NAVD' collector.set_datum(datum) collector.end_time = stop collector.start_time = start collector.variables = [sos_name] ofrs = collector.server.offerings title = collector.server.identification.title log.info(fmt(' Collector offerings ')) log.info('{}: {} offerings'.format(title, len(ofrs))) # In[10]: import requests from urlparse import urlparse
# <codecell> sos_urls = service_urls(csw.records, service='sos:url') print("\n".join(sos_urls)) # <markdowncell> # ## 1. Get observations from SOS # Here we are using a custom class from pyoos to read the CO-OPS SOS. This is definitely unsavory, as the whole point of using a standard is avoid the need for custom classes for each service. Need to examine the consequences of removing this and just going with straight SOS service using OWSLib. # <codecell> collector = CoopsSos() collector.set_datum('NAVD') # MSL collector.server.identification.title collector.start_time = jd_start collector.end_time = jd_stop collector.variables = [sos_name] # <codecell> ofrs = collector.server.offerings print(len(ofrs)) for p in ofrs[700:710]: print(p) # <markdowncell> # ### Find the SOS stations within our bounding box and time extent