Personal tools

ODPX Schema Examples

by admin last modified Mar 26, 2010 08:45 AM

Various example files using the ODPX Schema.

(The following can be found on this page)


Generic Example Files:

These files are examples of using the ODPX Schema to update the NECODP Exchange Network Node. They show how to add projects, monitoring locations, activities, results to an organization and otherwise manipulate your data stored in the node.

NOTE: The examples attempt to show as much of the schema as possible and therefore do not always make sense in terms of what one would consider actual data. You would probably never use every available element in a real situation.

NOTE 2: There is currently no example of attaching a binary object below. That example is forthcoming.

ODPX_Example.xml : Examples of most schema elements (including various forms of spatial data (point, line, polygon, envelope) and a time series for a single Observed Property. You may use this file to test submitting a file to the node.

The following example files should NOT be used for test submits. They have the GoMOOS organization identifier in them.

ODPX_Example_no_gcmd.xml : Examples of most schema elements (including various forms of spatial data (point, line, polygon, envelope) and a time series for a single Observed Property

ODPX_Example2.xml : Similar to the above example but the time series is an example with multiple observed properties, wind speed, wind direction and wind gust.

ODPX_Example3_add_new_project.xml : Add a new project (along with it's GCMD values) to an existing Organization. Only the Organization Identifier is required.

ODPX_Example4_add_new_project_ed_proj_gcmd.xml: Same as above. You really are replacing the existing data. This shows you how to update the project and it's GCMD details.

ODPX_Example5_add_new_project_ed_proj_only.xml: This updates ( replaces ) the project. If the project has an existing GCMD Details section that section is not altered and remains part of the Project after the update.

ODPX_Example6_add_new_ml.xml : Add a new Monitoring Location to an Organization.

ODPX_Example7_edit_new_ml.xml: Update (really replace)  a Monitoring Location.

ODPX_Example8_add_new_activity.xml: Add an Activity to an Organization. Only the Organization Identifier is required

ODPX_Example9_add_new_activity_edit.xml: Similar to the above example. You are again replacing the Activity. The Activities Results are altered and remain part of the activity.

ODPX_Example11_add_result_to_activity.xml: Add a Result ( Singular result non-timeseries ) to an Activity. Requires an Organization Identifier and and Activity Identifier. 

ODPX_Example11_A_add_result_time_series_to_activity.xml: Similar to the above example only a time series is added as a new result. This example has a single observed property.

ODPX_Example11B_add_result_time_series_to_activity.xml : Similar to the above example. The time series contains multiple observed properties, wind_speed, wind_direction and wind_gust.

ODPX_Example12_replace_Activity_and_results.xml: Replaces an Activity and all it's results.

 

Partner Organization Specific files:

These files are specific to a single partner and based on values from the Global Change Master Directory (GCMD)  and the Data Exchange Template (DET). The files have not been validated. Some fields have been filled in with "TBD". The intent is to give the partners a starting point for creating their own file for submission.

NOTE: Missing the entry you'd like to see? Send ian@gomoos.org an email with the GCMD ID and he'll generate one. (first one is free!)

CAUTION: Browsers ( Intenet Explorer, Firefox etc. ) usually interpret XML files for you, meaning they will not show you what is in the files directly but instead process them first. In the case of these examples that will most likely result in a page showing very little more than an error message. You must View the source to see the contents of the file.

NOTE : To see these files in Firefox please use View -> Page Source, In Internet Explorer View -> Source

GoMOOS.xml

NEFSC.xml : Assembled from the DET and  http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[GCMD]EMOLT&format=xml

OBIS.DFOgfsDBFish : Assembled from DET and http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=OBIS.DFOgfsDBfish%20&format=xml

NHDES_EMD.xml    http://www.gomoos.org/schema/NECODP_PartnerExamples/NHDES_EMD.xml

USGS_WRD_NWIS-W.xml Assembled From DET and http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[GCMD]USGS_WRD_NWIS-W&format=xml

 Canada_GoMODP_SEANETBBS.xml Assembled from DET and http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[CANADA-CGDI]Canada_GoMODP_SEANETBBS&format=xml

 WEBCOAST_COOA_Great_Bay_Buoy.xml Assembled from DET and http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[GCMD]WEBCOAST_COOA_Great_Bay_Buoy&format=xml

 gomc_74.xml Assembled from Det and http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[GCMD]GOMC_74&format=xml

Partner Data Submission Examples:

UNH Buoys.

 

 

Some Useful URLs for navigating the GCMD:

 

http://gcmd.gsfc.nasa.gov/OpenAPI/get_entry_ids.py?query=[Project:Short_Name=%27GOMODP%27]

 

:

Projects related to NECODP (formerly known as GOMODP

 

http://gcmd.gsfc.nasa.gov/OpenAPI/getdif.py?entry_id=[GCMD]GoMOOS_Buoys&format=xml

 

:Using the IDs obtained above, all data for a single GCMD Entity (Example is for GoMOOS)

 

Specific Sections Entry Title etc. from all NECODP related Projects

 

:Looking for sections Entry Title and References from all NECODP related entries.

 

DIF writers guide

: A guide to the "sections" used above.

 

Example Scripts creating and submitting ODPX Xml:

GoMOOS is submitting it's real-time data for Buoys A, B, E, F, I, M and N.

Submitted Data is selected from the GoMOOS PostgreSQL database and the GoMOOS SOS Web service, formatted to the ODPX XML standard and submitted.

We've done this in 4 distinct steps.

  1. Submitted and Organization, Project/GCMD  ODPX XML  file to the node. (This file was hand edited and submitted with NodeClientLite2)
  2. Submitted a Monitoring Location ODPX XML file for each Buoy to the Node (that's 7 files generated by a script  and submitted with NodeClientLite2).
  3. Submitted an Activity ODPX XML file for each Deployment of a Buoy to the Node (that's 142 files generated by a script and submitted with NodeClientLite2 ).
  4. Once an hour grab data from our SOS service, create an ODPX XML file for the results and submit that (7 files generated by a script and submitted by a script).

 

The PerlExamples.zip file contains sample scripts for:

  • README.txt
  • ml_import.pl
  • activity_import.pl
  • GoMOOS_result_import2.pl

http://www.gomoos.org/schema/PerlExamples.zip

 

Examples for using these scripts:


From README.txt (contained in PerlExamples.zip


Example Perl Scripts for automatic XML file generation.

(And one Perl Script for a node submission)

 

NOTE: These examples are for illustration purposes only. They will not "run" as is. Do not hesitate to ask for help, clarification etc. There are many ways of achieving the same results with these "tools".

NOTE 2: The node Submission comes after the 3 examples of ODPX XML file creation.

There are 3 distinct examples. All of these assume that an Organization and Project/GCMD already exist. The examples create XML to add Monitoring Locations to an Organization, Activities to an Organization and Results to an Activity.

The Results script is much more complicated than the other two. It uses SOS GetCapabilities and SOS GetOffering to create an ODPX XML Result.

 

These examples are for adding GoMOOS buoy data to the ODPX node, your needs might be different. 

  • Monitoring Location is very infrequent.
  • Adding Activities happens twice a year ( at buoy re-deployment).
  • Adding Results is hourly.

1) Adding Monitoring Locations to an Organization

ml_import.pl

This script is an example of querying a database to create an ODPX XML document.  It uses odpx_ml_import_template.xml. After the template is "loaded" into the software the results of the database query are used to fill in relevant information.

 

Using MonitoringLocationIdentifier as an example. When the template is loaded contains nothing.

 <MonitoringLocationIdentifier></MonitoringLocationIdentifier>


The script uses the database query result to fill in a value, here "A01"

 <MonitoringLocationIdentifier>A01</MonitoringLocationIdentifier>

               

2) Adding Activities to an Organization

activity_import.pl

This script is an example of querying a database to create an ODPX XML document. It uses odpx_activity_import_template.xml. After the template is "loaded" into the software the results of the database query are used to fill in relevant information.


Using ActivityIdentifier as an example. When the template is loaded contains nothing.

<ActivityIdentifier></ActivityIdentifier>

The script uses the database query result to fill in a value, here "A0123"

<ActivityIdentifier>A0123</ActivityIdentifier>

             

Additionally this script will compress the resulting files into a "ZIP" archive which can be submitted with the Windsor NodeClientLite2.             


3) Adding Results to an Organization

 GoMOOS_result_import2.pl

This script is an example of querying an SOS services GetCapabilities to determine available Observation Properties ( parameters or characteristics), using those results to build an SOS service GetObservations request and then using those results to create an ODPX XML file for submission.

Additionally  this script will compress the resulting files into a "ZIP" archive which can be submitted with the Windsor NodeClientLite2. It is similar to the preivious 2 scripts in that it uses "fill in the blanks" but it will also "cut" and "paste" xml elements into the resulting XML file.

 

For example all the "fields" (observed properties) available are added to the template on the fly

 

    <swe:field name="wind_speed">

    <swe:Quantity definition="http://mmisw.org/cf#wind_speed">

        <swe:uom code="m.s-1"/>                   

    </swe:Quantity>

                               

4) Node submission via a perl script.

SubmitFile.pl

This uses Perl and the WSO2 Perl module to submit a file to the Node. INSTALL_NOTES.txt contains information on installing the libraries needed to support this script. The installation can get complicated in a hurry....

Document Actions

Northeast Coastal and Ocean Data Partnership - Member Organizations

Bedford Institute of Oceanography Center for Marine Biodiversity The Huntsman Marine Science Center Census of Marine LIfe Gulf of Maine
Gulf of Maine Ocean Observing System
Coastal Ocean Observing Center U.S. Fish & Wildlife Service Gulf of Maine Council on the Marine Environment St. Andrews Biological Station
New Hampshire Department of Environmental Services
National Weather Service
NOAA Coastal Services Center National Undersea Research Center Maine Department of Marine Resources Massachusetts Office of Coastal Zone Management Environmental Protection Agency United States Geological Survey Seabird Ecological Assessment Network
Stellwagen Bank National Marine Sanctuary