Search OOI ERDDAP for Pioneer Glider Data

Use ERDDAP's RESTful advanced search to try to find OOI Pioneer glider water temperatures from the OOI ERDDAP. Use case from Stace Beaulieu (sbeaulieu@whoi.edu)


In [1]:
import pandas as pd

First try just searching for "glider"


In [2]:
url = 'http://ooi-data.marine.rutgers.edu/erddap/search/advanced.csv?page=1&itemsPerPage=1000&searchFor=glider'
dft = pd.read_csv(url, usecols=['Title', 'Summary', 'Institution', 'Dataset ID'])  
dft.head()


Out[2]:
Title Summary Institution Dataset ID
0 Coastal Endurance Mobile Assets Coastal Glider... Coastal Endurance Mobile Assets Coastal Glider... Ocean Observatories Initiative CE05MOAS-GL311-02-FLORTM000-flort_m_glider_ins...
1 Coastal Endurance Mobile Assets Coastal Glider... Coastal Endurance Mobile Assets Coastal Glider... Ocean Observatories Initiative CE05MOAS-GL311-05-CTDGVM000-ctdgv_m_glider_ins...
2 Coastal Endurance Mobile Assets Coastal Glider... Coastal Endurance Mobile Assets Coastal Glider... Ocean Observatories Initiative CE05MOAS-GL311-04-DOSTAM000-dosta_abcdjm_glide...
3 Coastal Endurance Mobile Assets Coastal Glider... Coastal Endurance Mobile Assets Coastal Glider... Ocean Observatories Initiative CE05MOAS-GL311-01-PARADM000-parad_m_glider_ins...
4 Coastal Endurance Mobile Assets Coastal Glider... Coastal Endurance Mobile Assets Coastal Glider... Ocean Observatories Initiative CE05MOAS-GL312-02-FLORTM000-flort_m_glider_ins...

Now search for all temperature data in specified bounding box and temporal extent


In [3]:
start = '2000-01-01T00:00:00Z'
stop  = '2017-02-22T00:00:00Z'
lat_min =  39.
lat_max =  41.5
lon_min = -72.
lon_max = -69.
standard_name = 'sea_water_temperature'
endpoint = 'http://ooi-data.marine.rutgers.edu/erddap/search/advanced.csv'

In [4]:
import pandas as pd


base = (
    '{}'
    '?page=1'
    '&itemsPerPage=1000'
    '&searchFor='
    '&protocol=(ANY)'
    '&cdm_data_type=(ANY)'
    '&institution=(ANY)'
    '&ioos_category=(ANY)'
    '&keywords=(ANY)'
    '&long_name=(ANY)'
    '&standard_name={}'
    '&variableName=(ANY)'
    '&maxLat={}'
    '&minLon={}'
    '&maxLon={}'
    '&minLat={}'
    '&minTime={}'
    '&maxTime={}').format

url = base(
    endpoint,
    standard_name,
    lat_max,
    lon_min,
    lon_max,
    lat_min,
    start,
    stop
)

print(url)


http://ooi-data.marine.rutgers.edu/erddap/search/advanced.csv?page=1&itemsPerPage=1000&searchFor=&protocol=(ANY)&cdm_data_type=(ANY)&institution=(ANY)&ioos_category=(ANY)&keywords=(ANY)&long_name=(ANY)&standard_name=sea_water_temperature&variableName=(ANY)&maxLat=41.5&minLon=-72.0&maxLon=-69.0&minLat=39.0&minTime=2000-01-01T00:00:00Z&maxTime=2017-02-22T00:00:00Z

In [5]:
dft = pd.read_csv(url, usecols=['Title', 'Summary', 'Institution','Dataset ID'])  

print('Datasets Found = {}'.format(len(dft)))
print(url)
dft


Datasets Found = 18
http://ooi-data.marine.rutgers.edu/erddap/search/advanced.csv?page=1&itemsPerPage=1000&searchFor=&protocol=(ANY)&cdm_data_type=(ANY)&institution=(ANY)&ioos_category=(ANY)&keywords=(ANY)&long_name=(ANY)&standard_name=sea_water_temperature&variableName=(ANY)&maxLat=41.5&minLon=-72.0&maxLon=-69.0&minLat=39.0&minTime=2000-01-01T00:00:00Z&maxTime=2017-02-22T00:00:00Z
Out[5]:
Title Summary Institution Dataset ID
0 Coastal Pioneer Central Offshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMCO-WFP01-04-FLORTK000-flort_kn_stc_imode...
1 Coastal Pioneer Central Offshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMCO-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_inst...
2 Coastal Pioneer Central Offshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMCO-WFP01-02-DOFSTK000-dofst_k_wfp_instru...
3 Coastal Pioneer Inshore Surface Mooring Near S... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP03ISSM-RID27-03-CTDBPC000-ctdbp_cdef_dcl_ins...
4 Coastal Pioneer Inshore Surface Mooring Seaflo... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP03ISSM-MFD37-03-CTDBPD000-ctdbp_cdef_dcl_ins...
5 Coastal Pioneer Offshore Profiler Mooring Wire... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP04OSPM-WFP01-04-FLORTK000-flort_kn_stc_imode...
6 Coastal Pioneer Offshore Profiler Mooring Wire... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP04OSPM-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_inst...
7 Coastal Pioneer Offshore Profiler Mooring Wire... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP04OSPM-WFP01-02-DOFSTK000-dofst_k_wfp_instru...
8 Coastal Pioneer Offshore Surface Mooring Near ... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP04OSSM-RID27-02-FLORTD000-flort_dj_dcl_instr...
9 Coastal Pioneer Offshore Surface Mooring Near ... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP04OSSM-RID27-03-CTDBPC000-ctdbp_cdef_dcl_ins...
10 Coastal Pioneer Offshore Surface Mooring Near ... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP04OSSM-RID27-04-DOSTAD000-dosta_abcdjm_dcl_i...
11 Coastal Pioneer Offshore Surface Mooring Seafl... Coastal Endurance Oregon Offshore Surface Moor... Ocean Observatories Initiative CP04OSSM-MFD37-03-CTDBPE000-ctdbp_cdef_dcl_ins...
12 Coastal Pioneer Upstream Inshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUI-WFP01-04-FLORTK000-flort_kn_stc_imode...
13 Coastal Pioneer Upstream Inshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUI-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_inst...
14 Coastal Pioneer Upstream Inshore Profiler Moor... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUI-WFP01-02-DOFSTK000-dofst_k_wfp_instru...
15 Coastal Pioneer Upstream Offshore Profiler Moo... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUO-WFP01-04-FLORTK000-flort_kn_stc_imode...
16 Coastal Pioneer Upstream Offshore Profiler Moo... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUO-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_inst...
17 Coastal Pioneer Upstream Offshore Profiler Moo... Coastal Endurance Washington Offshore Profiler... Ocean Observatories Initiative CP02PMUO-WFP01-02-DOFSTK000-dofst_k_wfp_instru...

Define a function that returns a Pandas DataFrame based on the dataset ID. The ERDDAP request variables (e.g. "ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature") are hard-coded here, so this routine should be modified for other ERDDAP endpoints or datasets.

Since we didn't actually find any glider data, we just request the last temperature value from each dataset, using the ERDDAP orderByMax("time") constraint. This way we can see when the data ends, and if the mooring locations look correct


In [6]:
def download_df(glider_id):
    from pandas import DataFrame, read_csv
#    from urllib.error import HTTPError
    uri = ('http://ooi-data.marine.rutgers.edu/erddap/tabledap/{}.csv'
           '?trajectory,'
           'time,latitude,longitude,'
           'ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature'
           '&orderByMax("time")'
           '&time>={}'
           '&time<={}'
           '&latitude>={}'
           '&latitude<={}'
           '&longitude>={}'
           '&longitude<={}').format
    url = uri(glider_id,start,stop,lat_min,lat_max,lon_min,lon_max)
    print(url)
    # Not sure if returning an empty df is the best idea.
    try:
        df = read_csv(url, index_col='time', parse_dates=True, skiprows=[1])
    except:
        df = pd.DataFrame()
    return df

In [7]:
df = pd.concat(list(map(download_df, dft['Dataset ID'].values)))


http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMCO-WFP01-04-FLORTK000-flort_kn_stc_imodem_instrument-telemetered-d0006.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMCO-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_instrument-telemetered-d0006.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMCO-WFP01-02-DOFSTK000-dofst_k_wfp_instrument-telemetered-d0006.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP03ISSM-RID27-03-CTDBPC000-ctdbp_cdef_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP03ISSM-MFD37-03-CTDBPD000-ctdbp_cdef_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSPM-WFP01-04-FLORTK000-flort_kn_stc_imodem_instrument-telemetered-d0005.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSPM-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_instrument-telemetered-d0005.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSPM-WFP01-02-DOFSTK000-dofst_k_wfp_instrument-telemetered-d0005.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSSM-RID27-02-FLORTD000-flort_dj_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSSM-RID27-03-CTDBPC000-ctdbp_cdef_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSSM-RID27-04-DOSTAD000-dosta_abcdjm_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP04OSSM-MFD37-03-CTDBPE000-ctdbp_cdef_dcl_instrument-telemetered-d0004.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUI-WFP01-04-FLORTK000-flort_kn_stc_imodem_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUI-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUI-WFP01-02-DOFSTK000-dofst_k_wfp_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUO-WFP01-04-FLORTK000-flort_kn_stc_imodem_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUO-WFP01-03-CTDPFK000-ctdpf_ckl_wfp_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0
http://ooi-data.marine.rutgers.edu/erddap/tabledap/CP02PMUO-WFP01-02-DOFSTK000-dofst_k_wfp_instrument-telemetered-d0007.csv?trajectory,time,latitude,longitude,ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature&orderByMax("time")&time>=2000-01-01T00:00:00Z&time<=2017-02-22T00:00:00Z&latitude>=39.0&latitude<=41.5&longitude>=-72.0&longitude<=-69.0

In [8]:
print('Total Data Values Found: {}'.format(len(df)))


Total Data Values Found: 8

In [9]:
df


Out[9]:
trajectory latitude longitude ctdpf_ckl_wfp_instrument_ctdpf_ckl_seawater_temperature
time
2016-09-05 21:03:41 CP02PMCO-WFP01-04-FLORTK000-flort_kn_stc_imode... 40.10068 -70.88820 17.5915
2016-09-05 21:05:47 CP02PMCO-WFP01-02-DOFSTK000-dofst_k_wfp_instru... 40.10068 -70.88820 17.5285
2016-09-27 12:11:16 CP04OSPM-WFP01-04-FLORTK000-flort_kn_stc_imode... 39.94325 -70.88667 23.3999
2016-09-27 12:13:26 CP04OSPM-WFP01-02-DOFSTK000-dofst_k_wfp_instru... 39.94325 -70.88667 23.3982
2016-10-04 13:35:22 CP02PMUI-WFP01-04-FLORTK000-flort_kn_stc_imode... 40.36533 -70.78090 14.9176
2016-10-04 13:37:27 CP02PMUI-WFP01-02-DOFSTK000-dofst_k_wfp_instru... 40.36533 -70.78090 14.9113
2016-10-01 09:03:39 CP02PMUO-WFP01-04-FLORTK000-flort_kn_stc_imode... 39.94212 -70.78002 23.0539
2016-10-01 09:05:45 CP02PMUO-WFP01-02-DOFSTK000-dofst_k_wfp_instru... 39.94212 -70.78002 23.0542

In [10]:
%matplotlib inline
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from cartopy.feature import NaturalEarthFeature

bathym_1000 = NaturalEarthFeature(name='bathymetry_J_1000',
                                  scale='10m', category='physical')

fig, ax = plt.subplots(
    figsize=(9, 9),
    subplot_kw=dict(projection=ccrs.PlateCarree())
)
ax.coastlines(resolution='10m')
ax.add_feature(bathym_1000, facecolor=[0.9, 0.9, 0.9], edgecolor='none')

dx = dy = 0.5
ax.set_extent([lon_min-dx, lon_max+dx, lat_min-dy, lat_max+dy])

g = df.groupby('trajectory')
for glider in g.groups:
    traj = df[df['trajectory'] == glider]
    ax.plot(traj['longitude'], traj['latitude'], 'o', label=glider)

gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True,
                  linewidth=2, color='gray', alpha=0.5, linestyle='--')

ax.legend();



In [ ]: