ioos / sos-guidelines-hugo

http://ioos.github.io/sos-guidelines
1 stars 4 forks source link

Repetition of //sml:output/swe:Quantity in DescribeSensor templates #11

Open mwengren opened 7 years ago

mwengren commented 7 years ago

Does anyone know why the //sml:output/swe:Quantity elements are repeated at the station and also station-component level in the DescribeSensor responses?

I've been looking into the OWSLib and pyoos code for parsing SensorML responses, and it looks like the pyoos/OWSLib approach is to obtain measured variables via the OWSLib System.components variables, which are obtained from this xpath: sml:components/sml:ComponentList/sml:component, relevant source code link here, and the corresponding pyoos code here.

XML snippit of sml:component:

<sml:component name="nanoos_apl_chaba_h1_turbidity_2">
            <sml:System gml:id="nanoos_apl_chaba_h1_turbidity_2">
              <sml:identification xlink:href="urn:ioos:sensor:nanoos:apl_chaba:h1_turbidity_2"/>
              <sml:documentation xlink:href="http://data.nanoos.org/52nsos/sos/kvp?request=DescribeSensor&amp;service=SOS&amp;version=1.0.0&amp;procedure=urn:ioos:sensor:nanoos:apl_chaba:h1_turbidity_2&amp;outputFormat=text%2Fxml%3B+subtype%3D%22sensorML%2F1.0.1%2Fprofiles%2Fioos_sos%2F1.0%22"/>
              <sml:outputs>
                <sml:OutputList>
                  <sml:output name="Sea Water Turbidity">
                    <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/sea_water_turbidity"/>
                  </sml:output>
                </sml:OutputList>
              </sml:outputs>
            </sml:System>
          </sml:component>

However, the same swe:Quantity elements are repeated at the //sml:System/sml:outputs/sml:OutputList level, without the level of detail included in the swe:component element:

<sml:outputs>
        <sml:OutputList>
          <sml:output name="Sea Water Temperature">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/sea_water_temperature"/>
          </sml:output>
          <sml:output name="Sea Water Salinity">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/sea_water_salinity"/>
          </sml:output>
          <sml:output name="Sea Water Turbidity">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/sea_water_turbidity"/>
          </sml:output>
          <sml:output name="Mass Concentration Of Oxygen In Sea Water">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/mass_concentration_of_oxygen_in_sea_water"/>
          </sml:output>
          <sml:output name="Net Downward Shortwave Flux In Air">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/net_downward_shortwave_flux_in_air"/>
          </sml:output>
          <sml:output name="Air Temperature">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/air_temperature"/>
          </sml:output>
          <sml:output name="H1 Pressure">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/sea_water_pressure"/>
          </sml:output>
          <sml:output name="H2 Nitrate">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/mole_concentration_of_nitrate_in_sea_water"/>
          </sml:output>
          <sml:output name="Wind From Direction">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/wind_from_direction"/>
          </sml:output>
          <sml:output name="Mass Concentration Of Chlorophyll In Sea Water">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/mass_concentration_of_chlorophyll_in_sea_water"/>
          </sml:output>
          <sml:output name="Dew Point Temperature">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/dew_point_temperature"/>
          </sml:output>
          <sml:output name="Relative Humidity">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/relative_humidity"/>
          </sml:output>
          <sml:output name="Surface Air Pressure">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/surface_air_pressure"/>
          </sml:output>
          <sml:output name="Wind Speed">
            <swe:Quantity definition="http://mmisw.org/ont/cf/parameter/wind_speed"/>
          </sml:output>
        </sml:OutputList>
      </sml:outputs>

Why are these repeated? Seems like a duplication. You can get the same information from both. Are they expected to be the same at all times? I didn't see this addressed in the docs at first review.

Specifically I've been looking at examples from NANOOS SOS, but I'm guessing this isn't exclusive to NANOOS. Emilio, I noticed in your code you are parsing the latter to get all of the sweQuantities in your sensorml.py code: https://github.com/nanoos-pnw/ioos-ws/blob/master/sensorml.py.

cc: @kwilcox @shane-axiom @emiliom @abirger

srstsavage commented 7 years ago

This is specific to i52n-sos. I'll take a look.

https://github.com/ioos/i52n-sos/issues/36

emiliom commented 7 years ago

FYI, I remember seeing that duplication but don't remember why I decided to go with //sml:System/sml:outputs/sml:OutputList. It's probably b/c it looked simpler to parse, and for my purposes I didn't need or could not profit from the potentially extra detailed information in sml:components/sml:ComponentList/sml:component (namely, associating specific sweQuantities with specific "sensors", which in the case of NANOOS are not actually sensors per se, but individual variables/parameters treated as sensors).

SensorML often provides more than one way of encoding things

mwengren commented 7 years ago

I'm not saying it's wrong as it is, just wondering why the need for both sections.

The pyoos code FWIW was written to store the extracted variable URI information from sml:components/sml:ComponentList/sml:component in the DescribeSensor.variables variable, eg:

http://mmisw.org/ont/cf/parameter/air_temperature
http://mmisw.org/ont/cf/parameter/dew_point_temperature
http://mmisw.org/ont/cf/parameter/mass_concentration_of_chlorophyll_in_sea_water
http://mmisw.org/ont/cf/parameter/mass_concentration_of_oxygen_in_sea_water
http://mmisw.org/ont/cf/parameter/mole_concentration_of_nitrate_in_sea_water
http://mmisw.org/ont/cf/parameter/net_downward_shortwave_flux_in_air
http://mmisw.org/ont/cf/parameter/relative_humidity
http://mmisw.org/ont/cf/parameter/sea_water_pressure
http://mmisw.org/ont/cf/parameter/sea_water_salinity
http://mmisw.org/ont/cf/parameter/sea_water_temperature
http://mmisw.org/ont/cf/parameter/sea_water_turbidity
http://mmisw.org/ont/cf/parameter/surface_air_pressure
http://mmisw.org/ont/cf/parameter/wind_from_direction
http://mmisw.org/ont/cf/parameter/wind_speed