In [1]:
from utilities import * 
css_styles()


Out[1]:

IOOS System Test - Theme 1 - Scenario D - Description

Exploring Dissolved Oxygen Data

Dissolved oxygen is a comon indicator of water quality and measures how much oxygen is dissolved in water samples. This test searches dissolved oxygen data in real-time sensors and models, and tries to ask if all the values are in the same units for comparison.

Guiding Questions

  1. Can we discover, access, and overlay dissolved oxygen information in sensors?
  2. Can we discover, access, and overlay dissolved oxygen information from models?
  3. Is data from different sensors and satellite data (or models) directly comparable? Same units? Same scales?
  4. If not, how much work is necessary to aggregate these streams?
  5. Is metadata for these data intelligable?

Q1 - Can we discover, access, and overlay salinity information?


In [5]:
from pylab import *
from IPython.display import HTML

In [6]:
import pandas as pd
pd.set_option('display.max_columns', 20)
pd.set_option('display.max_rows', 500)
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://mmisw.org/sparql")

query = """
PREFIX ioos: <http://mmisw.org/ont/ioos/parameter/>
SELECT DISTINCT ?cat ?parameter ?property ?value 
WHERE {?parameter a ioos:Parameter .
       ?parameter ?property ?value .
       ?cat skos:narrowMatch ?parameter .
       FILTER  (regex(str(?property), "Match", "i") && regex(str(?value), "cf", "i") )
      } 
ORDER BY ?cat ?parameter
"""
    
sparql.setQuery(query)
sparql.setReturnFormat(JSON)
j = sparql.query().convert()

cf_standard_uris  = list(set([ x["value"]["value"] for x in j.get("results").get("bindings") ]))
cf_standard_names = map(lambda x: x.split("/")[-1], cf_standard_uris)
pd.DataFrame.from_records(zip(cf_standard_names, cf_standard_uris), columns=("CF Name", "CF URI",))


/home/will/anaconda/lib/python2.7/site-packages/SPARQLWrapper/Wrapper.py:88: RuntimeWarning: JSON-LD disabled because no suitable support has been found
  warnings.warn("JSON-LD disabled because no suitable support has been found", RuntimeWarning)
Out[6]:
CF Name CF URI
0 sea_surface_height_correction_due_to_air_press... http://mmisw.org/ont/cf/parameter/sea_surface_...
1 lagrangian_tendency_of_air_pressure http://mmisw.org/ont/cf/parameter/lagrangian_t...
2 radiation_wavelength http://mmisw.org/ont/cf/parameter/radiation_wa...
3 mole_concentration_of_phosphate_in_sea_water http://mmisw.org/ont/cf/parameter/mole_concent...
4 platform_course http://mmisw.org/ont/cf/parameter/platform_course
5 sea_surface_swell_wave_mean_period_from_varian... http://mmisw.org/ont/cf/parameter/sea_surface_...
6 wind_to_direction http://mmisw.org/ont/cf/parameter/wind_to_dire...
7 air_pressure_at_convective_cloud_base http://mmisw.org/ont/cf/parameter/air_pressure...
8 surface_partial_pressure_of_carbon_dioxide_in_... http://mmisw.org/ont/cf/parameter/surface_part...
9 tendency_of_air_pressure http://mmisw.org/ont/cf/parameter/tendency_of_...
10 sea_surface_swell_wave_significant_height http://mmisw.org/ont/cf/parameter/sea_surface_...
11 moles_of_nitrate_per_unit_mass_in_sea_water http://mmisw.org/ont/cf/parameter/moles_of_nit...
12 sea_surface_height_correction_due_to_air_press... http://mmisw.org/ont/cf/parameter/sea_surface_...
13 sea_surface_height_amplitude_due_to_earth_tide http://mmisw.org/ont/cf/parameter/sea_surface_...
14 mole_concentration_of_dissolved_organic_carbon... http://mmisw.org/ont/cf/parameter/mole_concent...
15 eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/eastward_sea...
16 water_surface_height_above_reference_datum http://mmisw.org/ont/cf/parameter/water_surfac...
17 sound_intensity_level_in_water http://mmisw.org/ont/cf/parameter/sound_intens...
18 sea_surface_wave_mean_period_from_variance_spe... http://mmisw.org/ont/cf/parameter/sea_surface_...
19 sea_surface_wave_mean_period_from_variance_spe... http://mmisw.org/ont/cf/parameter/sea_surface_...
20 mole_concentration_of_nitrate_in_sea_water http://mmisw.org/ont/cf/parameter/mole_concent...
21 northward_wind http://mmisw.org/ont/cf/parameter/northward_wind
22 freezing_level_altitude http://mmisw.org/ont/cf/parameter/freezing_lev...
23 mass_concentration_of_phosphate_in_sea_water http://mmisw.org/ont/cf/parameter/mass_concent...
24 height_above_sea_floor http://mmisw.org/ont/cf/parameter/height_above...
25 eastward_wind http://mmisw.org/ont/cf/parameter/eastward_wind
26 sound_intensity_level_in_air http://mmisw.org/ont/cf/parameter/sound_intens...
27 air_temperature http://mmisw.org/ont/cf/parameter/air_temperature
28 depth_below_geoid http://mmisw.org/ont/cf/parameter/depth_below_...
29 altitude http://mmisw.org/ont/cf/parameter/altitude
30 sea_surface_wind_wave_mean_period_from_varianc... http://mmisw.org/ont/cf/parameter/sea_surface_...
31 product_of_eastward_sea_water_velocity_and_sal... http://mmisw.org/ont/cf/parameter/product_of_e...
32 surface_geostrophic_northward_sea_water_veloci... http://mmisw.org/ont/cf/parameter/surface_geos...
33 height_at_cloud_top http://mmisw.org/ont/cf/parameter/height_at_cl...
34 sea_surface_wave_variance_spectral_density http://mmisw.org/ont/cf/parameter/sea_surface_...
35 sea_surface_wind_wave_significant_height http://mmisw.org/ont/cf/parameter/sea_surface_...
36 sea_floor_depth_below_sea_level http://mmisw.org/ont/cf/parameter/sea_floor_de...
37 sea_surface_wind_wave_mean_period_from_varianc... http://mmisw.org/ont/cf/parameter/sea_surface_...
38 northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/northward_se...
39 sea_water_alkalinity_expressed_as_mole_equivalent http://mmisw.org/ont/cf/parameter/sea_water_al...
40 depth http://mmisw.org/ont/cf/parameter/depth
41 sea_surface_subskin_temperature http://mmisw.org/ont/cf/parameter/sea_surface_...
42 surface_altitude http://mmisw.org/ont/cf/parameter/surface_alti...
43 air_pressure_at_convective_cloud_top http://mmisw.org/ont/cf/parameter/air_pressure...
44 sea_water_ph_reported_on_total_scale http://mmisw.org/ont/cf/parameter/sea_water_ph...
45 sea_surface_wave_from_direction http://mmisw.org/ont/cf/parameter/sea_surface_...
46 upward_latent_heat_flux_in_air http://mmisw.org/ont/cf/parameter/upward_laten...
47 surface_downward_northward_stress http://mmisw.org/ont/cf/parameter/surface_down...
48 sea_surface_wind_wave_to_direction http://mmisw.org/ont/cf/parameter/sea_surface_...
49 sea_surface_wind_wave_mean_period_from_varianc... http://mmisw.org/ont/cf/parameter/sea_surface_...
50 air_pressure_at_sea_level http://mmisw.org/ont/cf/parameter/air_pressure...
51 wind_speed http://mmisw.org/ont/cf/parameter/wind_speed
52 platform_pitch_angle http://mmisw.org/ont/cf/parameter/platform_pit...
53 mass_fraction_of_chlorophyll_a_in_sea_water http://mmisw.org/ont/cf/parameter/mass_fractio...
54 radial_sea_water_velocity_away_from_instrument http://mmisw.org/ont/cf/parameter/radial_sea_w...
55 cloud_top_altitude http://mmisw.org/ont/cf/parameter/cloud_top_al...
56 sea_water_pressure_at_sea_floor http://mmisw.org/ont/cf/parameter/sea_water_pr...
57 moles_of_nitrate_and_nitrite_per_unit_mass_in_... http://mmisw.org/ont/cf/parameter/moles_of_nit...
58 volume_absorption_coefficient_of_radiative_flu... http://mmisw.org/ont/cf/parameter/volume_absor...
59 direction_of_radial_vector_away_from_instrument http://mmisw.org/ont/cf/parameter/direction_of...
60 upward_sensible_heat_flux_in_air http://mmisw.org/ont/cf/parameter/upward_sensi...
61 sea_surface_wave_period_at_variance_spectral_d... http://mmisw.org/ont/cf/parameter/sea_surface_...
62 cloud_base_altitude http://mmisw.org/ont/cf/parameter/cloud_base_a...
63 air_temperature_at_cloud_top http://mmisw.org/ont/cf/parameter/air_temperat...
64 upward_heat_flux_in_sea_water_due_to_convection http://mmisw.org/ont/cf/parameter/upward_heat_...
65 altitude_at_top_of_dry_convection http://mmisw.org/ont/cf/parameter/altitude_at_...
66 equilibrium_line_altitude http://mmisw.org/ont/cf/parameter/equilibrium_...
67 upward_sea_water_velocity http://mmisw.org/ont/cf/parameter/upward_sea_w...
68 sea_surface_salinity http://mmisw.org/ont/cf/parameter/sea_surface_...
69 sea_surface_swell_wave_to_direction http://mmisw.org/ont/cf/parameter/sea_surface_...
70 surface_air_pressure http://mmisw.org/ont/cf/parameter/surface_air_...
71 sea_water_electrical_conductivity http://mmisw.org/ont/cf/parameter/sea_water_el...
72 sea_water_practical_salinity http://mmisw.org/ont/cf/parameter/sea_water_pr...
73 sea_surface_height_amplitude_due_to_equilibriu... http://mmisw.org/ont/cf/parameter/sea_surface_...
74 surface_geostrophic_eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/surface_geos...
75 secchi_depth_of_sea_water http://mmisw.org/ont/cf/parameter/secchi_depth...
76 mass_concentration_of_inorganic_nitrogen_in_se... http://mmisw.org/ont/cf/parameter/mass_concent...
77 sea_water_temperature http://mmisw.org/ont/cf/parameter/sea_water_te...
78 sea_water_density http://mmisw.org/ont/cf/parameter/sea_water_de...
79 sea_water_pressure_due_to_sea_water http://mmisw.org/ont/cf/parameter/sea_water_pr...
80 surface_carbon_dioxide_partial_pressure_differ... http://mmisw.org/ont/cf/parameter/surface_carb...
81 thickness_of_rainfall_amount http://mmisw.org/ont/cf/parameter/thickness_of...
82 temperature_of_sensor_for_oxygen_in_sea_water http://mmisw.org/ont/cf/parameter/temperature_...
83 air_temperature_anomaly http://mmisw.org/ont/cf/parameter/air_temperat...
84 sea_water_pressure_at_sea_water_surface http://mmisw.org/ont/cf/parameter/sea_water_pr...
85 upward_air_velocity http://mmisw.org/ont/cf/parameter/upward_air_v...
86 wind_speed_of_gust http://mmisw.org/ont/cf/parameter/wind_speed_o...
87 sea_water_pressure http://mmisw.org/ont/cf/parameter/sea_water_pr...
88 bolus_eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/bolus_eastwa...
89 platform_yaw_angle http://mmisw.org/ont/cf/parameter/platform_yaw...
90 sea_surface_wave_significant_height http://mmisw.org/ont/cf/parameter/sea_surface_...
91 sea_floor_depth_below_geoid http://mmisw.org/ont/cf/parameter/sea_floor_de...
92 sea_surface_height_above_sea_level http://mmisw.org/ont/cf/parameter/sea_surface_...
93 difference_of_air_pressure_from_model_reference http://mmisw.org/ont/cf/parameter/difference_o...
94 sea_surface_wave_to_direction http://mmisw.org/ont/cf/parameter/sea_surface_...
95 fractional_saturation_of_oxygen_in_sea_water http://mmisw.org/ont/cf/parameter/fractional_s...
96 geostrophic_northward_wind http://mmisw.org/ont/cf/parameter/geostrophic_...
97 mole_concentration_of_ammonium_in_sea_water http://mmisw.org/ont/cf/parameter/mole_concent...
98 bolus_northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/bolus_northw...
99 model_level_number_at_sea_floor http://mmisw.org/ont/cf/parameter/model_level_...
100 sea_surface_swell_wave_zero_upcrossing_period http://mmisw.org/ont/cf/parameter/sea_surface_...
101 depth_of_isosurface_of_sea_water_potential_tem... http://mmisw.org/ont/cf/parameter/depth_of_iso...
102 baroclinic_eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/baroclinic_e...
103 geostrophic_eastward_wind http://mmisw.org/ont/cf/parameter/geostrophic_...
104 platform_azimuth_angle http://mmisw.org/ont/cf/parameter/platform_azi...
105 sea_water_turbidity http://mmisw.org/ont/cf/parameter/sea_water_tu...
106 barotropic_eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/barotropic_e...
107 air_pressure_anomaly http://mmisw.org/ont/cf/parameter/air_pressure...
108 mole_concentration_of_nitrite_in_sea_water http://mmisw.org/ont/cf/parameter/mole_concent...
109 height http://mmisw.org/ont/cf/parameter/height
110 sea_surface_height_above_reference_ellipsoid http://mmisw.org/ont/cf/parameter/sea_surface_...
111 air_temperature_lapse_rate http://mmisw.org/ont/cf/parameter/air_temperat...
112 moles_of_nitrite_per_unit_mass_in_sea_water http://mmisw.org/ont/cf/parameter/moles_of_nit...
113 tropopause_air_temperature http://mmisw.org/ont/cf/parameter/tropopause_a...
114 mass_concentration_of_chlorophyll_in_sea_water http://mmisw.org/ont/cf/parameter/mass_concent...
115 platform_roll_angle http://mmisw.org/ont/cf/parameter/platform_rol...
116 sea_surface_height_bias_due_to_sea_surface_rou... http://mmisw.org/ont/cf/parameter/sea_surface_...
117 surface_partial_pressure_of_carbon_dioxide_in_air http://mmisw.org/ont/cf/parameter/surface_part...
118 mole_concentration_of_bacteria_expressed_as_ca... http://mmisw.org/ont/cf/parameter/mole_concent...
119 sea_surface_wave_zero_upcrossing_period http://mmisw.org/ont/cf/parameter/sea_surface_...
120 surface_geostrophic_eastward_sea_water_velocit... http://mmisw.org/ont/cf/parameter/surface_geos...
121 latitude http://mmisw.org/ont/cf/parameter/latitude
122 mole_concentration_of_nitrate_and_nitrite_in_s... http://mmisw.org/ont/cf/parameter/mole_concent...
123 magnitude_of_surface_downward_stress http://mmisw.org/ont/cf/parameter/magnitude_of...
124 sea_surface_wave_mean_period_from_variance_spe... http://mmisw.org/ont/cf/parameter/sea_surface_...
125 sea_surface_swell_wave_mean_period_from_varian... http://mmisw.org/ont/cf/parameter/sea_surface_...
126 sea_floor_depth_below_sea_surface http://mmisw.org/ont/cf/parameter/sea_floor_de...
127 air_pressure_at_cloud_base http://mmisw.org/ont/cf/parameter/air_pressure...
128 thickness_of_snowfall_amount http://mmisw.org/ont/cf/parameter/thickness_of...
129 sea_surface_skin_temperature http://mmisw.org/ont/cf/parameter/sea_surface_...
130 sea_surface_height_amplitude_due_to_pole_tide http://mmisw.org/ont/cf/parameter/sea_surface_...
131 air_pressure_at_cloud_top http://mmisw.org/ont/cf/parameter/air_pressure...
132 mass_concentration_of_oxygen_in_sea_water http://mmisw.org/ont/cf/parameter/mass_concent...
133 mole_ratio_of_nitrate_to_phosphate_in_sea_water http://mmisw.org/ont/cf/parameter/mole_ratio_o...
134 sea_surface_temperature http://mmisw.org/ont/cf/parameter/sea_surface_...
135 surface_eastward_sea_water_velocity http://mmisw.org/ont/cf/parameter/surface_east...
136 barotropic_northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/barotropic_n...
137 longitude http://mmisw.org/ont/cf/parameter/longitude
138 sea_water_salinity http://mmisw.org/ont/cf/parameter/sea_water_sa...
139 air_pressure http://mmisw.org/ont/cf/parameter/air_pressure
140 surface_downward_eastward_stress http://mmisw.org/ont/cf/parameter/surface_down...
141 sea_surface_wave_directional_variance_spectral... http://mmisw.org/ont/cf/parameter/sea_surface_...
142 wave_frequency http://mmisw.org/ont/cf/parameter/wave_frequency
143 wind_from_direction http://mmisw.org/ont/cf/parameter/wind_from_di...
144 tropopause_air_pressure http://mmisw.org/ont/cf/parameter/tropopause_a...
145 sea_surface_swell_wave_mean_period_from_varian... http://mmisw.org/ont/cf/parameter/sea_surface_...
146 sea_surface_height_above_geoid http://mmisw.org/ont/cf/parameter/sea_surface_...
147 direction_of_sea_water_velocity http://mmisw.org/ont/cf/parameter/direction_of...
148 sea_water_speed http://mmisw.org/ont/cf/parameter/sea_water_speed
149 sea_surface_height_amplitude_due_to_geocentric... http://mmisw.org/ont/cf/parameter/sea_surface_...
150 change_over_time_in_sea_water_density http://mmisw.org/ont/cf/parameter/change_over_...
151 mole_concentration_of_particulate_organic_matt... http://mmisw.org/ont/cf/parameter/mole_concent...
152 mass_concentration_of_chlorophyll_a_in_sea_water http://mmisw.org/ont/cf/parameter/mass_concent...
153 surface_geostrophic_northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/surface_geos...
154 moles_of_phosphate_per_unit_mass_in_sea_water http://mmisw.org/ont/cf/parameter/moles_of_pho...
155 height_above_reference_ellipsoid http://mmisw.org/ont/cf/parameter/height_above...
156 eastward_sea_water_velocity_assuming_no_tide http://mmisw.org/ont/cf/parameter/eastward_sea...
157 northward_sea_water_velocity_assuming_no_tide http://mmisw.org/ont/cf/parameter/northward_se...
158 air_pressure_at_freezing_level http://mmisw.org/ont/cf/parameter/air_pressure...
159 mole_concentration_of_dissolved_inorganic_carb... http://mmisw.org/ont/cf/parameter/mole_concent...
160 platform_speed_wrt_ground http://mmisw.org/ont/cf/parameter/platform_spe...
161 surface_carbon_dioxide_partial_pressure_differ... http://mmisw.org/ont/cf/parameter/surface_carb...
162 surface_northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/surface_nort...
163 convective_cloud_base_altitude http://mmisw.org/ont/cf/parameter/convective_c...
164 sea_surface_wind_wave_period http://mmisw.org/ont/cf/parameter/sea_surface_...
165 sea_surface_swell_wave_period http://mmisw.org/ont/cf/parameter/sea_surface_...
166 baroclinic_northward_sea_water_velocity http://mmisw.org/ont/cf/parameter/baroclinic_n...
167 sea_surface_height_amplitude_due_to_non_equili... http://mmisw.org/ont/cf/parameter/sea_surface_...
168 sea_surface_wind_wave_zero_upcrossing_period http://mmisw.org/ont/cf/parameter/sea_surface_...
169 air_temperature_threshold http://mmisw.org/ont/cf/parameter/air_temperat...

Geographic subset

This test looks at the East Coast of the United States.


In [7]:
bounding_box = [ -81.03, 27.59, -66.14, 44.92]  # East Coast

"Geographic subset: {!s}".format(bounding_box)


Out[7]:
'Geographic subset: [-81.03, 27.59, -66.14, 44.92]'

Temporal subset

January 1, 2014 to August 1, 2014


In [8]:
from datetime import datetime
start_date = datetime(2014,1,1)
start_date_string = start_date.strftime('%Y-%m-%d %H:00')

end_date = datetime(2014,8,1)
end_date_string = end_date.strftime('%Y-%m-%d %H:00')

"Temporal subset: ( {!s} to {!s} )".format(start_date_string, end_date_string)


Out[8]:
'Temporal subset: ( 2014-01-01 00:00 to 2014-08-01 00:00 )'

Set variable subset

Define the variables. It turns out that dissolved oxygen is not an IOOS Core Variable in MMI, so we need to append it to the list of other standard names that are standard.


In [9]:
variables_to_query = [ x for x in cf_standard_names if "oxygen" in x ]
custom_variables   = ['dissolved_oxygen', 'oxygen']  # Do we need any, or are they all extractable from MMI?

variables_to_query += custom_variables
"Variable subset: {!s}".format(" , ".join(variables_to_query))


Out[9]:
'Variable subset: temperature_of_sensor_for_oxygen_in_sea_water , fractional_saturation_of_oxygen_in_sea_water , mass_concentration_of_oxygen_in_sea_water , dissolved_oxygen , oxygen'

Define all known the CSW endpoints


In [10]:
# https://github.com/ioos/system-test/wiki/Service-Registries-and-Data-Catalogs
known_csw_servers = ['http://data.nodc.noaa.gov/geoportal/csw',
                     'http://www.nodc.noaa.gov/geoportal/csw',
                     'http://www.ngdc.noaa.gov/geoportal/csw',
                     'http://cwic.csiss.gmu.edu/cwicv1/discovery',
                     'http://geoport.whoi.edu/geoportal/csw',
                     'https://edg.epa.gov/metadata/csw',
                     'http://cmgds.marine.usgs.gov/geonetwork/srv/en/csw',
                     'http://cida.usgs.gov/gdp/geonetwork/srv/en/csw',
                     'http://geodiscover.cgdi.ca/wes/serviceManagerCSW/csw',
                     'http://geoport.whoi.edu/gi-cat/services/cswiso',
                     'https://data.noaa.gov/csw',
                     ]

Construct CSW Filters


In [11]:
from owslib import fes
def fes_date_filter(start_date='1900-01-01',stop_date='2100-01-01',constraint='overlaps'):
    if constraint == 'overlaps':
        start = fes.PropertyIsGreaterThanOrEqualTo(propertyname='apiso:TempExtent_end', literal=start_date)
        stop = fes.PropertyIsLessThanOrEqualTo(propertyname='apiso:TempExtent_begin', literal=stop_date)
    elif constraint == 'within':
        start = fes.PropertyIsGreaterThanOrEqualTo(propertyname='apiso:TempExtent_begin', literal=start_date)
        stop = fes.PropertyIsLessThanOrEqualTo(propertyname='apiso:TempExtent_end', literal=stop_date)
    return fes.And([start, stop])

In [12]:
# Standard Name filters
cf_name_filters = []
for cf_name in variables_to_query:
    text_filter   = fes.PropertyIsLike(propertyname='apiso:AnyText', literal="*%s*" % cf_name, wildCard='*')
    cf_name_filters.append(text_filter)
cf_name_filters = fes.Or(cf_name_filters)

# Geographic filters
geographic_filter = fes.BBox(bbox=bounding_box)

# Temporal filters
temporal_filter = fes_date_filter(start_date_string, end_date_string)

filters = fes.And([cf_name_filters, geographic_filter, temporal_filter])
The actual CSW filter POST envelope looks like this

In [13]:
from owslib.etree import etree
print etree.tostring(filters.toXML(), pretty_print=True)


<ogc:And xmlns:ogc="http://www.opengis.net/ogc">
  <ogc:Or>
    <ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\">
      <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
      <ogc:Literal>*temperature_of_sensor_for_oxygen_in_sea_water*</ogc:Literal>
    </ogc:PropertyIsLike>
    <ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\">
      <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
      <ogc:Literal>*fractional_saturation_of_oxygen_in_sea_water*</ogc:Literal>
    </ogc:PropertyIsLike>
    <ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\">
      <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
      <ogc:Literal>*mass_concentration_of_oxygen_in_sea_water*</ogc:Literal>
    </ogc:PropertyIsLike>
    <ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\">
      <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
      <ogc:Literal>*dissolved_oxygen*</ogc:Literal>
    </ogc:PropertyIsLike>
    <ogc:PropertyIsLike wildCard="*" singleChar="_" escapeChar="\">
      <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
      <ogc:Literal>*oxygen*</ogc:Literal>
    </ogc:PropertyIsLike>
  </ogc:Or>
  <ogc:BBOX>
    <ogc:PropertyName>ows:BoundingBox</ogc:PropertyName>
    <gml311:Envelope xmlns:gml311="http://www.opengis.net/gml">
      <gml311:lowerCorner>-81.03 27.59</gml311:lowerCorner>
      <gml311:upperCorner>-66.14 44.92</gml311:upperCorner>
    </gml311:Envelope>
  </ogc:BBOX>
  <ogc:And>
    <ogc:PropertyIsGreaterThanOrEqualTo>
      <ogc:PropertyName>apiso:TempExtent_end</ogc:PropertyName>
      <ogc:Literal>2014-01-01 00:00</ogc:Literal>
    </ogc:PropertyIsGreaterThanOrEqualTo>
    <ogc:PropertyIsLessThanOrEqualTo>
      <ogc:PropertyName>apiso:TempExtent_begin</ogc:PropertyName>
      <ogc:Literal>2014-08-01 00:00</ogc:Literal>
    </ogc:PropertyIsLessThanOrEqualTo>
  </ogc:And>
</ogc:And>

Filter out CSW servers that do not support a BBOX query

In [14]:
from owslib.csw import CatalogueServiceWeb
bbox_endpoints = []
for url in known_csw_servers:
    queryables = []
    try:
        csw = CatalogueServiceWeb(url, timeout=20)
    except BaseException:
        print "Failure - %s - Timed out" % url
    if "BBOX" in csw.filters.spatial_operators:
        print "Success - %s - BBOX Query supported" % url
        bbox_endpoints.append(url)    
    else:
        print "Failure - %s - BBOX Query NOT supported" % url


Success - http://data.nodc.noaa.gov/geoportal/csw - BBOX Query supported
Success - http://www.nodc.noaa.gov/geoportal/csw - BBOX Query supported
Success - http://www.ngdc.noaa.gov/geoportal/csw - BBOX Query supported
Success - http://cwic.csiss.gmu.edu/cwicv1/discovery - BBOX Query supported
Success - http://geoport.whoi.edu/geoportal/csw - BBOX Query supported
Success - https://edg.epa.gov/metadata/csw - BBOX Query supported
Success - http://cmgds.marine.usgs.gov/geonetwork/srv/en/csw - BBOX Query supported
Success - http://cida.usgs.gov/gdp/geonetwork/srv/en/csw - BBOX Query supported
Success - http://geodiscover.cgdi.ca/wes/serviceManagerCSW/csw - BBOX Query supported
Failure - http://geoport.whoi.edu/gi-cat/services/cswiso - Timed out
Success - http://geoport.whoi.edu/gi-cat/services/cswiso - BBOX Query supported
Success - https://data.noaa.gov/csw - BBOX Query supported

Query CSW Servers using filters


In [15]:
urls = []
service_types = []
servers = []
for url in bbox_endpoints:
    print "*", url
    try:
        csw = CatalogueServiceWeb(url, timeout=20)
        csw.getrecords2(constraints=[filters], maxrecords=200, esn='full')
        for record, item in csw.records.items():
            # Get URLs
            service_url, scheme = next(((d['url'], d['scheme']) for d in item.references), None)
            if service_url:
                if len(item.title) > 100:
                    title = "{!s}...{!s}".format(item.title[0:50], item.title[-50:])
                else:
                    title = item.title    
                print "    [x] {!s}".format(title)
                
                urls.append(service_url)
                service_types.append(scheme)
                servers.append(url)
    except BaseException as e:
        print "    [-] FAILED: {!s}".format(e)


* http://data.nodc.noaa.gov/geoportal/csw
    [x] Temperature, salinity, oxygen, chlorophyll, and pr...from 1985 through present (NODC Accession 0068584)
    [x] OC334L01: WHOI cruise 334 leg 01 aboard the R/V Oc...m 1998-11-30 - 2020-12-01 (NODC Accession 0078935)
    [x] Temperature, salinity, and other profile data coll...rom 07/24/1972 to present (NODC Accession 0038589)
    [x] Temperature, salinity and dissolved oxygen profile... 1995-09-07 to 2014-10-31 (NODC Accession 0042682)
    [x] Oceanographic and surface meteorological data coll... 2014-02-13 to 2014-10-31 (NODC Accession 0118793)
    [x] Oceanographic and surface meteorological data coll... 2014-02-13 to 2014-10-31 (NODC Accession 0118794)
    [x] Oceanographic and surface meteorological data coll... 2014-02-13 to 2014-10-31 (NODC Accession 0118795)
* http://www.nodc.noaa.gov/geoportal/csw
    [-] FAILED: timed out
* http://www.ngdc.noaa.gov/geoportal/csw
    [x] HRECOS Aggregated Station HRALBPH Data
    [x] HRECOS Aggregated Station HRLCK8H Data
    [x] HRECOS Aggregated Station HRMARPH Data
    [x] HRECOS Aggregated Station HRPIER84 Data
    [x] HRECOS Aggregated Station HRWSTPTH Data
    [x] lbhmc.2ndave.pier
    [x] lbhmc.apachepier.pier
    [x] lbhmc.cherrygrove.pier
    [x] HRECOS Aggregated Station HRPMNTH Data
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Massachusetts Bay: A01 OPTODE51m Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...1 Massachusetts Bay: A01 DOPPLER Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...stern Maine Shelf: B01 DOPPLER Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ntral Maine Shelf: E01 DOPPLER Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ions: F01 Penobscot Bay: F01 DOPPLER Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...stern Maine Shelf: I01 DOPPLER Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: M01 Jordan Basin: M01 DOPPLER Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...rvations: F01 Penobscot Bay: F01 MET Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...1 Eastern Maine Shelf: I01 MET Eastern Maine Shelf
    [x] B01 SBE16 - CTD Observations
    [x] E01 SBE16 - CTD Observations
    [x] I01 SBE16 - CTD Observations
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...achusetts Bay: A01 ACCELEROMETER Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...A01 Massachusetts Bay: A01 CTD1m Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...01 Massachusetts Bay: A01 CTD20m Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...: A01 Massachusetts Bay: A01 MET Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ... Massachusetts Bay: A01 OPTICS3m Massachusetts Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tern Maine Shelf: B01 AANDERAA Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Maine Shelf: B01 ACCELEROMETER Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Western Maine Shelf: B01 CTD1m Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...estern Maine Shelf: B01 CTD20m Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...estern Maine Shelf: B01 CTD50m Western Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tern Maine Shelf: B0126 CTD52m Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...1 Western Maine Shelf: B01 MET Western Maine Shelf
    [x] B01 Aanderaa - Historic Surface Currents
    [x] B01 SBE16 - CTD Transmissivity
    [x] TEMPESTS MA101 Water Level - CINAR
    [x] TEMPESTS MA101 Met - CINAR
    [x] TEMPESTS MA101 SBE37 1m CTD - CINAR
    [x] TEMPESTS MA101 Waves - CINAR
    [x] TEMPESTS MD101 Water Level - CINAR
    [x] TEMPESTS MD101 Met - CINAR
    [x] TEMPESTS MD101 SBE37 1m CTD - CINAR
    [x] TEMPESTS MD101 Waves - CINAR
    [x] TEMPESTS ME101 Water Level - CINAR
    [x] TEMPESTS ME101 Met - CINAR
    [x] TEMPESTS ME101 SBE37 1m CTD - CINAR
    [x] TEMPESTS ME101 Waves - CINAR
    [x] TEMPESTS NJ101 Water Level - CINAR
    [x] TEMPESTS NJ101 Met - CINAR
    [x] TEMPESTS NJ101 SBE37 1m CTD - CINAR
    [x] TEMPESTS NJ101 Waves - CINAR
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tral Maine Shelf: E01 AANDERAA Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Maine Shelf: E01 ACCELEROMETER Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Central Maine Shelf: E01 CTD1m Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...entral Maine Shelf: E01 CTD20m Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...entral Maine Shelf: E01 CTD50m Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...entral Maine Shelf: E01 CTD87m Central Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...1 Central Maine Shelf: E01 MET Central Maine Shelf
    [x] E01 Aanderaa - Historic Surface Currents
    [x] E01 SBE16 - CTD Transmissivity
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ons: F01 Penobscot Bay: F01 AANDERAA Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...F01 Penobscot Bay: F01 ACCELEROMETER Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: F01 Penobscot Bay: F01 CTD1m Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tions: F01 Penobscot Bay: F01 CTD20m Penobscot Bay
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tions: F01 Penobscot Bay: F01 CTD50m Penobscot Bay
    [x] F01 Aanderaa - Historic Surface Currents
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tern Maine Shelf: I01 AANDERAA Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Maine Shelf: I01 ACCELEROMETER Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...Eastern Maine Shelf: I01 CTD1m Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...astern Maine Shelf: I01 CTD20m Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...astern Maine Shelf: I01 CTD50m Eastern Maine Shelf
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tern Maine Shelf: I0129 CTD87m Central Maine Shelf
    [x] I01 Aanderaa - Historic Surface Currents
    [x] I01 SBE16 - CTD Transmissivity
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...tions: M01 Jordan Basin: M01 AANDERAA Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...: M01 Jordan Basin: M01 ACCELEROMETER Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...rvations: M01 Jordan Basin: M01 CTD1m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...vations: M01 Jordan Basin: M01 CTD20m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...vations: M01 Jordan Basin: M01 CTD50m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: M01 Jordan Basin: M01 CTD100m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: M01 Jordan Basin: M01 CTD150m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: M01 Jordan Basin: M01 CTD200m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...ations: M01 Jordan Basin: M01 CTD250m Jordan Basin
    [x] NERACOOS Gulf of Maine Ocean Array: Realtime Buoy ...servations: M01 Jordan Basin: M01 MET Jordan Basin
    [x] M01 Aanderaa - Historic Surface Currents
* http://cwic.csiss.gmu.edu/cwicv1/discovery
    [-] FAILED: 'REQUEST_EXCEPTION: MISSING_CRS - Required srsName attribute was not found in <Envelope>.'
* http://geoport.whoi.edu/geoportal/csw
    [-] FAILED: 'Invalid parameter value: locator=PropertyName'
* https://edg.epa.gov/metadata/csw
* http://cmgds.marine.usgs.gov/geonetwork/srv/en/csw
* http://cida.usgs.gov/gdp/geonetwork/srv/en/csw
* http://geodiscover.cgdi.ca/wes/serviceManagerCSW/csw
    [-] FAILED: 'ORA-00907: missing right parenthesis'
* http://geoport.whoi.edu/gi-cat/services/cswiso
    [-] FAILED: timed out
* https://data.noaa.gov/csw

What service are available?


In [16]:
srvs = pd.DataFrame(zip(urls, service_types, servers), columns=("URL", "Service Type", "Server"))
srvs = srvs.drop_duplicates()
pd.set_option('display.max_rows', 10)
srvs


Out[16]:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 86 entries, 0 to 91
Data columns (total 3 columns):
URL             86  non-null values
Service Type    86  non-null values
Server          86  non-null values
dtypes: object(3)

What types of service are available


In [17]:
pd.DataFrame(srvs.groupby("Service Type").size(), columns=("Number of services",))


Out[17]:
Number of services
Service Type
urn:x-esri:specification:ServiceType:ArcIMS:Metadata:Onlink 1
urn:x-esri:specification:ServiceType:distribution:url 85
SOS and DAP Servers are not properly identified
One can not tell (programatically) what the "urn:x-esri:specification:ServiceType:distribution:url" scheme actually is.

SOS


In [18]:
def find_sos(x):
    d = x.lower()
    if "sos" in d and "dods" not in d:
        return x
    return None

In [19]:
sos_servers = filter(None, srvs["URL"].map(find_sos))
sos_servers


Out[19]:
[]
No SOS Servers Found
There are no SOS servers that are found using the CSW filters

DAP


In [54]:
def find_dap(x):
    d = x.lower()
    if ("dap" in d or "dods" in d) and "tabledap" not in d:
        return x
    return None

In [55]:
import os
dap_servers = filter(None, srvs["URL"].map(find_dap))
dap_servers = map(lambda x: os.path.splitext(x)[0], dap_servers)
dap_servers


Out[55]:
['http://sos.maracoos.org/stable/dodsC/stationHRALBPH-agg.ncml',
 'http://sos.maracoos.org/stable/dodsC/stationHRLCK8H-agg.ncml',
 'http://sos.maracoos.org/stable/dodsC/stationHRMARPH-agg.ncml',
 'http://sos.maracoos.org/stable/dodsC/stationHRPIER84-agg.ncml',
 'http://sos.maracoos.org/stable/dodsC/stationHRWSTPTH-agg.ncml',
 'http://tds.secoora.org/thredds/dodsC/lbhmc.2ndave.pier.nc',
 'http://tds.secoora.org/thredds/dodsC/lbhmc.apachepier.pier.nc',
 'http://tds.secoora.org/thredds/dodsC/lbhmc.cherrygrove.pier.nc',
 'http://sos.maracoos.org/stable/dodsC/stationHRPMNTH-agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Doppler/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Met/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Met/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Met/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/OPTICS_S3m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/OPTODE51m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Aanderaa/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD50m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD52m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Met/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Aanderaa/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD50m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD87m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Met/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Aanderaa/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD50m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Aanderaa/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD50m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD87m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Aanderaa/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Accelerometer/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD1m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD20m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD50m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD100m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD150m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD200m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD250m/HistoricRealtime/Agg.ncml',
 'http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Met/HistoricRealtime/Agg.ncml']

Try to extract dissolved oxygen data from all of the DAP endpoints


In [59]:
import iris
import iris.plot as iplt
import matplotlib.pyplot as plt
%matplotlib inline

variables = lambda cube: cube.standard_name in variables_to_query
constraint = iris.Constraint(cube_func=variables)


def iris_grid_plot(cube_slice, name=None):
    plt.figure(figsize=(12, 8))
    lat = cube_slice.coord(axis='Y').points
    lon = cube_slice.coord(axis='X').points
    time = cube_slice.coord('time')[0]
    plt.subplot(111, aspect=(1.0 / cos(mean(lat) * pi / 180.0)))
    plt.pcolormesh(lon, lat, ma.masked_invalid(cube_slice.data));
    plt.colorbar()
    plt.grid()
    date = time.units.num2date(time.points)
    date_str = date[0].strftime('%Y-%m-%d %H:%M:%S %Z')
    plt.title('%s: %s: %s' % (name, cube_slice.long_name, date_str));
    plt.show()

for dap in dap_servers:
    print "[*]  {!s}".format(dap)
    try:
        cube = iris.load_cube(dap, constraint)
    except BaseException as e:
        print "    [-]  Could not load: {!s}".format(e)
        continue
    
    print "    [-]  Identified as a Grid"
    print "    [-]  {!s}".format(cube.attributes["title"])
    try:
        try:
            cube.coord(axis='T').rename('time')
        except:
            pass
        if len(cube.shape) == 4:
            cube = cube[0, -1, ::1, ::1]
        elif len(cube.shape) == 3:
            cube = cube[0, ::1, ::1]
        elif len(cube.shape) == 2:
            cube = cube[::1, ::1]
        else:
            raise ValueError("Dimensions do not adhere to plotting requirements")
        iris_grid_plot(cube, cube.attributes["title"])
            
    except ValueError as e:
        print "    [-]  Could not plot: {!s}".format(e)
        continue


[*]  http://sos.maracoos.org/stable/dodsC/stationHRALBPH-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
[*]  http://sos.maracoos.org/stable/dodsC/stationHRLCK8H-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRALBPH-agg.ncml')> ignored
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRLCK8H-agg.ncml')> ignored
Exception 
[*]  http://sos.maracoos.org/stable/dodsC/stationHRMARPH-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
[*]  http://sos.maracoos.org/stable/dodsC/stationHRPIER84-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRMARPH-agg.ncml')> ignored
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRPIER84-agg.ncml')> ignored
Exception 
[*]  http://sos.maracoos.org/stable/dodsC/stationHRWSTPTH-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
[*]  http://tds.secoora.org/thredds/dodsC/lbhmc.2ndave.pier.nc
    [-]  Could not load: failed to merge into a single cube.
  cube.var_name differs: u'dissolved_oxygen' != u'dissolved_oxygen_2'
[*]  http://tds.secoora.org/thredds/dodsC/lbhmc.apachepier.pier.nc
    [-]  Could not load: failed to merge into a single cube.
  cube.var_name differs: u'dissolved_oxygen' != u'dissolved_oxygen_2'
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRWSTPTH-agg.ncml')> ignored
/home/kwilcox/.virtualenvs/system-test/lib/python2.7/site-packages/Iris-1.7.0_dev-py2.7.egg/iris/fileformats/_pyke_rules/compiled_krb/fc_rules_cf_fc.py:1357: UserWarning: Failed to create 'time' dimension coordinate: The points array must be strictly monotonic.
Gracefully creating 'time' auxiliary coordinate instead.
  error=e_msg))
[*]  http://tds.secoora.org/thredds/dodsC/lbhmc.cherrygrove.pier.nc
    [-]  Could not load: failed to merge into a single cube.
  cube.var_name differs: u'dissolved_oxygen' != u'dissolved_oxygen_2'
[*]  http://sos.maracoos.org/stable/dodsC/stationHRPMNTH-agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://sos.maracoos.org/stable/dodsC/stationHRPMNTH-agg.ncml')> ignored
Exception 
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Exception 
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Exception AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Exception 
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Exception 
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Doppler/HistoricRealtime/Agg.ncml
    [-]  Could not load: NetCDF: Malformed or inaccessible DAP DDS
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Exception 
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/OPTICS_S3m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/A01/OPTODE51m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Aanderaa/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD50m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/CTD52m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/B01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Aanderaa/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD50m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/CTD87m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/E01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Aanderaa/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/F01/CTD50m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Aanderaa/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD50m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/I01/CTD87m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Aanderaa/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Accelerometer/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD1m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD20m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD50m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD100m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD150m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD200m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/CTD250m/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
[*]  http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Met/HistoricRealtime/Agg.ncml
    [-]  Could not load: 'long_name' is not a permitted attribute
AttributeError: "'CFReader' object has no attribute '_dataset'" in <bound method CFReader.__del__ of CFReader('http://www.neracoos.org/thredds/dodsC/UMO/DSG/SOS/M01/Doppler/HistoricRealtime/Agg.ncml')> ignored
Miscellaneous Errors - Many DAP endpoints for dissolved oxygens said data was available, but returned errors related to "malformed or inaccessible DAP DDS" (a catchall issue that can be difficult to resolve for users), variable names such as "dissolved_oxygen_2", and missing attributes in netCDF files.

In [ ]: