Finding Near real-time current data


In [4]:
import os
import sys
import time
import warnings

ioos_tools = os.path.join(os.path.pardir)
sys.path.append(ioos_tools)

In [5]:
from datetime import datetime, timedelta

# Region.
bbox = [-123, 36, -121, 40]
crs = 'urn:ogc:def:crs:OGC:1.3:CRS84'
    
# Temporal range.
now = datetime.utcnow()
start,  stop = now - timedelta(days=(7)), now

# Names.
cf_names = ['*surface_northward_sea_water_velocity*',
            '*surface_eastward_sea_water_velocity*']

In [17]:
from owslib import fes
from ioos_tools.ioos import fes_date_filter

kw = dict(wildCard='*', escapeChar='\\',
          singleChar='?', propertyname='apiso:AnyText')

or_filt = fes.Or([fes.PropertyIsLike(literal=('*%s*' % val), **kw)
                  for val in cf_names])

# Exclude ROMS Averages and History files.
not_filt = fes.Not([fes.PropertyIsLike(literal='*GNOME*', **kw)])

begin, end = fes_date_filter(start, stop)
bbox_crs = fes.BBox(bbox, crs=crs)
filter_list = [fes.And([bbox_crs, begin, end, or_filt, not_filt])]
filter_list = [fes.And([or_filt, not_filt])]

In [20]:
from owslib.csw import CatalogueServiceWeb


catalogs = ['http://www.ngdc.noaa.gov/geoportal/csw',
            'https://dev-catalog.ioos.us/csw',
            'http://geoport.whoi.edu/csw']

for endpoint in catalogs:
    csw = CatalogueServiceWeb(endpoint, timeout=60)
    csw.getrecords2(constraints=filter_list, maxrecords=1000, esn='full')
    print(endpoint)
    print(csw.records.keys())


http://www.ngdc.noaa.gov/geoportal/csw
['USEGC/RTV/6km/HFRADAR,_US_East_and_Gulf_Coast,_6km_Resolution,_Hourly_RTV_best.ncd', 'USHI/RTV/2km/HFRADAR,_US_Hawaii,_2km_Resolution,_Hourly_RTV_best.ncd', 'HFRNet/AKNS/6km/hourly/RTV', 'HFRNet/PRVI/2km/hourly/RTV', 'HFRNet/PRVI/6km/hourly/RTV', 'HFRNet/USEGC/1km/hourly/RTV', 'HFRNet/USEGC/2km/hourly/RTV', 'HFRNet/USEGC/6km/hourly/RTV', 'HFRNet/USHI/1km/hourly/RTV', 'HFRNet/USHI/2km/hourly/RTV', 'HFRNet/USHI/6km/hourly/RTV', 'HFRNet/USWC/1km/hourly/RTV', 'HFRNet/USWC/2km/hourly/RTV', 'HFRNet/USWC/6km/hourly/RTV', 'HFRNet/USWC/500m/hourly/RTV', 'HFR/AKNS/6km/hourly/RTV/HFRADAR,_Alaska_-_North_Slope,_6km_Resolution,_Hourly_RTV_best.ncd', 'HFR/PRVI/2km/hourly/RTV/HFRADAR,_Puerto_Rico_and_the_US_Virgin_Islands,_2km_Resolution,_Hourly_RTV_best.ncd', 'HFR/PRVI/6km/hourly/RTV/HFRADAR,_Puerto_Rico_and_the_US_Virgin_Islands,_6km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USEGC/1km/hourly/RTV/HFRADAR,_US_East_and_Gulf_Coast,_1km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USEGC/2km/hourly/RTV/HFRADAR,_US_East_and_Gulf_Coast,_2km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USEGC/6km/hourly/RTV/HFRADAR,_US_East_and_Gulf_Coast,_6km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USHI/1km/hourly/RTV/HFRADAR,_US_Hawaii,_1km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USHI/2km/hourly/RTV/HFRADAR,_US_Hawaii,_2km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USHI/6km/hourly/RTV/HFRADAR,_US_Hawaii,_6km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USWC/1km/hourly/RTV/HFRADAR,_US_West_Coast,_1km_Resolution,_Hourly_RTV_best.ncd', 'HFR/USWC/2km/hourly/RTV/HFRADAR,_US_West_Coast,_2km_Resolution,_Hourly_RTV_best.ncd', 'HFRADAR_USHI_hourly_RTV_1km', 'HFRADAR_USHI_hourly_RTV_2km', 'HFRADAR_USHI_hourly_RTV_6km']
https://dev-catalog.ioos.us/csw
['ud_134-20150122T1955', 'deployments/rutgers/unit_191-20150105T1443/unit_191-20150105T1443.nc3.nc', 'deployments/rutgers/ru23-20121025T1944/ru23-20121025T1944.nc3.nc', 'deployments/rutgers/ud_134-20150122T1955/ud_134-20150122T1955.nc3.nc', 'ncep_global', 'roms_hiog_forecast', 'FVCOM-Nowcast-Agg', 'deployments/rutgers/ud_134-20150105T1601/ud_134-20150105T1601.nc3.nc', 'UCSC', 'HYCOM']
http://geoport.whoi.edu/csw
[]

In [ ]:


In [ ]: