You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This guide will help experienced users of the Oceans 2.0 web interface understand how to programmatically create Oceans 2.0 API data product requests, using the information available on the Data Search page, when they make an interactive data product request.

Instruments by Location Search

A typical, programmatic request for a data product request for an 'Instruments by Location' search, would use the following orderDataProduct() function call, available in one of the ONC client libraries:

 

Python Example
from onc.onc import ONC
onc = ONC('YOUR_TOKEN_HERE')

results = onc.orderDataProduct({'locationCode':'BACAX',
		                        'deviceCategoryCode':'ADCP2MHZ',
        		                'dataProductCode':'TSSD',
                		        'extension':'csv',
                        		'begin':'2016-07-27T00:00:00.000Z',
                        		'end':'2016-08-01T00:00:00.000Z',
                        		'dpo_qualityControl':1,
                        		'dpo_resample':'none',
                        		'dpo_dataGaps':0})
MATLAB Example
o = onc('YOUR_TOKEN_HERE');

results = o.orderDataProduct(struct('locationCode','BACAX',...
                				    'deviceCategoryCode','ADCP2MHZ',...
                				    'dataProductCode','TSSD',...
                				    'extension','csv',...
                				    'begin','2016-07-27T00:00:00.000Z',...
                				    'end','2016-08-01T00:00:00.000Z',...
                				    'dpo_qualityControl',1,...
                				    'dpo_resample','none',...
                				    'dpo_dataGaps',0));
R Example
library("onc")
onc = new("onc",token='YOUR_TOKEN_HERE')

results = onc.orderDataProduct(onc,
                               list(locationCode="BACAX",
                				    deviceCategoryCode="ADCP2MHZ",
                				    dataProductCode="TSSD",
                				    extension="csv",
                				    begin="2016-07-27T00:00:00.000Z",
                				    end="2016-08-01T00:00:00.000Z",
                				    dpo_qualityControl=1,
                				    dpo_resample="none",
                				    dpo_dataGaps=0))

 

To create the filters needed to order a data product using the API, you can use Data Search to define the data product request interactively,  using the following steps

  1. Open data search http://data.oceannetworks.ca/DataSearch
    1. Select 'Instruments by Location' from the 'Sort by' drop-down
    2. Navigate to the location and device category of your data and click 'Next' (or 'Select Data Product')
    3. Enter a 'Date From' and 'Date To'.
    4. Select the data product and options you are interested in.
  2. Capture the locationCode, deviceCategoryCode from the URL at the top of the browser
  3. Capture the dates from the date section of the page
  4. Click on the link for the Data Product you are interested in and use the documentation to retrieve the dataProductCode, extension and all data product options you have identified in the appropriate data product options and codes. The data product documentation includes the API data product option codes for every Data Product Option available on the Data Search page.

  • No labels