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

Compare with Current View Page History

« Previous Version 19 Next »

Description

API scalardata allows users to get scalar data.

URL

http://data.oceannetworks.ca/api/scalardata
MethodDescriptionExample
getByLocationReturns scalar data by given location code and device categorymethod=getByLocation

* getByStation was deprecated as of October 1, 2017 (see bottom of this page for documentation). It has been replaced by the getByLocation method.

getByLocation

Returns scalar data in JSON format by given location code and device category code.

Parameters

ParameterTypeDescriptionExample
Required
tokenstringcredential token in GUID formatffffffff-ffff-ffff-ffff-ffffffffffff
locationCodestringthe code of a locationKVIP.C2
deviceCategoryCodestringthe code of a device categoryBPR
Optional
propertyCodeStringthe code of a propertyseawatertemperature

sensorCategoryCodes

StringA comma separated list of sensor code name. If missing, the system will return all search scalar data within the location code, device category pair, and propertyCode (if given).pressure,borehole_pressure1,oxygen
dateFromdateinclusive start date in "yyyy-MM-ddTHH:mm:ss.SSSZ" format. If missing, the system will return last reading.2015-05-25T00:00:00.000Z
dateTodateexclusive end date in "yyyy-MM-ddTHH:mm:ss.SSSZ" format. If missing the system will use 1 day range.2015-05-26T20:01:23.456Z
metadataString

Minimum (default or if missing) (case insensitive)
provides only basic property information

Full  (case insensitive)
provides all property information

metadata is for the latest deployment overlapping dateFrom and dateTo or, if no dates specified, the latest deployment overall

Minimum
rowLimitintegermaximum row scalar data returns for each sensor code. For those data they are sorted by sample time. If missing or invalid number, the maximum 100,000 will be used. If given number is over 100,000, the maximum 100,000 will be used.80000
outputFormatString

Array  (default or if missing)  (case insensitive)

data will be out put as three arrays for a given sensor. Array of sampleTime, array of values, array of qaqcFlags

Object(case insensitive)
data will be output as a list of objects for a given sensor. Inside each data object, there are sampleTime, value, and qaqcFlag

Object
getLatestBoolean Whether the latest raw data readings should be returned first. This is false by default. When set to true, readings are returned and pagination is done from latest to earliesttrue


Response

Success

{
	"metadata": {
		"boundingBox": {
			"maxDepth":<Double>,
			"maxLat":<Double>,
			"maxLon":<Double>,
			"minDepth":<Double>,
			"minLat":<Double>,
			"minLon":<Double>
		},
		"depth":<Double>,
		"deviceCategoryCode":<String>,
		"lat":<Double>,
		"locationName":<String>,
		"lon":<Double>
	},
	"next": {
		"parameters": {
			"metadata":<String>,
			"method":"getByLocation",
			"dateTo":<String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
			"rowLimit":<String>,
			"locationCode":<String>,
			"deviceCategoryCode":<String>,
			"sensorCategoryCodes":<String>,
		 	"dateFrom":<String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
			"outputFormat" : <String>,
            "token":<String (GUID)>
		},
		"url": <String (URL)>
	},
	"queryUrl": <String (URL)>,
	"sensorData": [
		{
			"data": {
				"qaqcFlags": <Array of integers>,
				"sampleTimes": <Array of String (yyyy-MM-dd'T'HH:mm:ss.SSS'Z')>,
				"values": <Array of doubles>
			},
			"sensorCode":<String>,
			"sensorName":<String>,
			"unitOfMeasure":<String>
		},
		...
	]
}
PropertyTypeDescriptionExample
nextObjectAn object containing information on how to make a rawdata call if the current call was unable to return all the data as a limit was exceeded. This is null if there is no more data in the requested range.
 
  • next.parameters
ObjectAn object containing the set of parameters making up the query to get the next set of data in the requested date range. The parameters will include all parameters passed into the original URL.
 
    • next.parameters.metadata
StringAs passed into the original call"minimum"
    • next.parameters.method
StringgetByLocation, as passed into the original call."getByLocation"
    • next.parameters.dateTo
StringAs passed into the original call
"2015-02-25T00:00:01.000Z"
    • next.parameters.rowLimit
StringAs passed into the original call"10"
    • next.parameters.locationCode
StringAs passed into the original call"NC27"
    • next.parameters.deviceCategoryCode
StringAs passed into the original call"CORK"
    • next.parameters.sensorCategoryCodes
StringAs passed into the original call"pressure"
    • next.parameters.dateFrom
StringThis is set to 1 millisecond more than the date of the last reading sent in the current call.
"2015-02-25T00:00:01.189Z"
    • next.parameters.outputFormat
StringAs passed into the original call"object"
    • next.parameters.token
StringAs passed into the original call"ffffffff-ffff-ffff-ffff-ffffffffffff"
  • next.url
StringThe complete URL that can be used to get the next set of data in the requested range.
"https://data.oceannetworks.ca/api/scalardata?method=getByLocation&dateTo=2015-02-25T00%3A00%3A01.000Z&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00%3A00%3A01.189Z&token=ffffffff-ffff-ffff-ffff-ffffffffffff"
queryUrlStringURL of current query
"https://data.oceannetworks.ca/api/scalardata?method=getByLocation&dateTo=2015-02-25T00%3A00%3A01.000Z&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00%3A00%3A00.000Z&token=ffffffff-ffff-ffff-ffff-ffffffffffff"
sensorDataArray of objectsData sets returned for all applicable sensors 
  • sensorData.data
ObjectData sets returned for a single sensor 
    • sensorData.data.qaqcFlags
Array of integers

QAQC test results of each data point–guidelines for what each number means:

  • 0 No quality control on data
  • 1 Data passed all tests
  • 2 Data probably good
  • 3 Data probably bad. Failed minor tests
  • 4 Data bad. Failed major tests
  • 7 Averaged value
  • 8 Interpolated value
  • 9 Missing data
[1]
    • sensorData.data.sampleTimes
Array of stringsSampling times of sensor data returned, formatted as
yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
["2015-02-25T00:00:00.188Z"]
    • sensorData.data.values
Array of doublesValues of sensor data returned, units of measurement are given in sensorData.unitOfMeasure[2706.1145305467917]
  • sensorData.sensorCode
StringCode of sensor, can be null"sigmaT"
  • sensorData.sensorName
StringName that denotes what the sensor measures
"Uncompensated Borehole Pressure"
  • sensorData.unitOfMeasure
StringUnit of measurement or "NA" if none apply; temperature units of measure are "C" for degrees Celsius
"Gregorian days since 19700101T000000Z"
metadataObjectOptional; only returned if the metadata parameter is set to full 
  • metadata.boundingBox
ObjectBounding limits statistics 
    • metadata.boundingBox.maxDepth
DoubleMaximum depth in meters below water surface (negative numbers denote above)982.0
    • metadata.boundingBox.maxLat
DoubleMaximum latitude in degrees north of the equator (negative numbers denote south)48.316583
    • metadata.boundingBox.maxLon
DoubleMaximum longitude in degrees east of the prime meridian (negative numbers denote west)-126.050796
    • metadata.boundingBox.minDepth
DoubleMinimum depth in meters below water surface (negative numbers denote above)982.0
    • metadata.boundingBox.minLat
DoubleMinimum latitude in degrees north of the equator (negative numbers denote south)48.316583
    • metadata.boundingBox.minLon
DoubleMinimum longitude in degrees east of the prime meridian (negative numbers denote west)-126.050796
  • metadata.depth
DoubleDepth in meters below water surface (negative numbers denote above)2660.5
  • metadata.deviceCategoryCode
StringShould be the same as next.parameters.deviceCategoryCode"CORK"
  • metadata.lat
DoubleLatitude in degrees north of the equator (negative numbers denote south)47.7626
  • metadata.locationName
StringName of location"ODP 1026"
  • metadata.lon
DoubleLongitude in degrees east of the prime meridian (negative numbers denote west)-127.759212

Note: Not all the properties above may be included in the resulting JSON, especially parameters that were not in the original call.

Example

https://data.oceannetworks.ca/api/scalardata?method=getByLocation&token=ffffffffffffffff&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00:00:00.000Z&dateTo=2015-02-25T00:00:01.000Z&propertyCode=totalpressure&sensorCategoryCodes=pressure

{ 
   "next":{ 
      "parameters":{ 
         "propertyCode":"totalpressure",
         "method":"getByLocation",
         "sensorCategoryCodes":"pressure,borehole_pressure1",
         "dateTo":"2015-02-25T00:00:01.000Z",
         "locationCode":"NC27",
         "deviceCategoryCode":"CORK",
         "dateFrom":"2015-02-25T00:00:01.189Z",
         "token":"c9ed940d-1c48-49ca-9bbd-1b126cb50917"
      },
      "url":"https://data.oceannetworks.ca/api/scalardata?propertyCode=totalpressure&sensorCategoryCodes=pressure,borehole_pressure1&method=getByLocation&dateTo=2015-02-25T00%3A00%3A01.000Z&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00%3A00%3A01.189Z&token=fffffffffffff"
   },
   "queryUrl":"https://data.oceannetworks.ca/api/scalardata?method=getByLocation&token=fffffffffffff&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00:00:00.000Z&dateTo=2015-02-25T00:00:01.000Z&propertyCode=totalpressure&sensorCategoryCodes=pressure,borehole_pressure1",
   "sensorData":[ 
      { 
         "data":{ 
            "qaqcFlags":[ 
               1
            ],
            "sampleTimes":[ 
               "2015-02-25T00:00:00.188Z"
            ],
            "values":[ 
               2706.1145305467917
            ]
         },
         "sensorCode":"Pressure",
         "sensorName":"Uncompensated Seafloor Pressure",
         "unitOfMeasure":"decibar"
      },
      { 
         "data":{ 
            "qaqcFlags":[ 
               1
            ],
            "sampleTimes":[ 
               "2015-02-25T00:00:00.188Z"
            ],
            "values":[ 
               2705.9145624950315
            ]
         },
         "sensorCode":"borehole_pressure1",
         "sensorName":"Uncompensated Borehole Pressure",
         "unitOfMeasure":"decibar"
      }
   ]
}


Example with outputFormat option

https://data.oceannetworks.ca/api/scalardata?method=getByLocation&token=ffffffffffffff&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00:00:00.000Z&dateTo=2015-02-25T00:00:01.000Z&propertyCode=totalpressure


{  
   "next":{  
      "parameters":{  
         "propertyCode":"totalpressure",
         "method":"getByLocation",
         "dateTo":"2015-02-25T00:00:01.000Z",
         "locationCode":"NC27",
         "deviceCategoryCode":"CORK",
         "dateFrom":"2015-02-25T00:00:01.189Z",
         "outputFormat":"object",
         "token":"c9ed940d-1c48-49ca-9bbd-1b126cb50917"
      },
      "url":"https://data.oceannetworks.ca/api/scalardata?propertyCode=totalpressure&method=getByLocation&dateTo=2015-02-25T00%3A00%3A01.000Z&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00%3A00%3A01.189Z&outputFormat=object&token=fffffffffffff"
   },
   "queryUrl":"https://data.oceannetworks.ca/api/scalardata?method=getByLocation&token=fffffffffffff&locationCode=NC27&deviceCategoryCode=CORK&dateFrom=2015-02-25T00:00:00.000Z&dateTo=2015-02-25T00:00:01.000Z&propertyCode=totalpressure&outputFormat=object",
   "sensorData":[  
      {  
         "data":[  
            {  
               "qaqcFlag":1,
               "sampleTime":"2015-02-25T00:00:00.188Z",
               "value":2706.1145305467917
            }
         ],
         "sensorCode":"Pressure",
         "sensorName":"Uncompensated Seafloor Pressure",
         "unitOfMeasure":"decibar"
      },
      {  
         "data":[  
            {  
               "qaqcFlag":1,
               "sampleTime":"2015-02-25T00:00:00.188Z",
               "value":2705.9145624950315
            }
         ],
         "sensorCode":"borehole_pressure1",
         "sensorName":"Uncompensated Borehole Pressure",
         "unitOfMeasure":"decibar"
      }
   ]
}


getByStation (no longer available - deprecated)

Returns scalar data in JSON format by given station code and device category code. 

Parameters

ParameterTypeDescriptionExample
Required
tokenstringcredential token in GUID format

ffffffff-ffff-ffff-ffff-ffffffffffff

stationstringthe code of a stationNCBC
deviceCategorystringthe code of a device categoryBPR
Optional
sensorsstringa comma separated list of sensor code name. If missing, the system will return all search scalar data within the station code and device category pair.pressure,temperature
dateFromdateinclusive start date in "yyyy-MM-ddTHH:mm:ss.SSSZ" format. If missing, the system will return last reading.2015-05-25T00:00:00.000Z
dateTodateexclusive end date in "yyyy-MM-ddTHH:mm:ss.SSSZ" format. If missing, the system will use a 24-hour range.2015-05-26T00:00:00.000Z
metadataString

Minimum (default or if missing) (case insensitive)
provides only basic property information

Full  (case insensitive)
provides all property information

metadata is for the latest deployment overlapping dateFrom and dateTo or, if no dates specified, the latest deployment overall

Minimum
outputFormatString

Object (default or if missing)  (case insensitive)

data will be output as a list of objects for a given sensor. Inside each data object, there are sampleTime, value, and qaqcFlag

Array  (case insensitive)
data will be out put as three arrays for a given sensor. Array of sampleTime, array of values, array of qaqcFlags

Object
rowLimitintegermaximum row scalar data returns for each sensor code. For those data they are sorted by sample time. If missing or invalid number, the maximum 100,000 will be used. If given number is over 100,000, the maximum 100,000 will be used.80000

 

Response

Success

Sample <responseType> Response
{
    "metadata": {
        "bbox": {
			"maxDepth": double,
			"maxLat": double,
			"maxLon": double,
			"minDepth": double,
			"minLat": double,
			"minLon": double
		},
        "dateFrom": string,
        "dateTo": string,
        "depth": double,
        "deviceCategoryName": string,
        "latitude": double,
        "longitude": double,
        "stationName": string
	},
	"sensorData": [
		{
			"actualSamples": integer,
			"data": [//outputFormat=object
				{
					"sampleTime": string,
					"value": double,
	   				"qaqcFlag": integer
	 			},
				...
			],
			"data": [//outputFormat=array
				{
					"sampleTimes": [array of strings],
					"values": [array of doubles],
	   				"qaqcFlags": [array of integers]
	 			},
				...
			],
			"sensor": string,
            "sensorName": string,
            "unitOfMeasure": string
		},
		...
	],
	"serviceMetadata": {
		"dateFrom": string,
        "dateTo": string,
        "deviceCategory": string,
        "metadata": string,
		"nextDateFrom": string,
		"outputFormat": string,
        "rowLimit": string,
		"sensors": string,
    	"station": string,
		"totalActualSamples": integer
	}
}
PropertyTypeDescriptionOptionNotes
serviceMetadatajson objectmeta data information of the web service request.metadata=minimum 
serviceMetadata.stationstringrequested station codemetadata=minimum 
serviceMetadata.deviceCategorystringrequested device category codemetadata=minimum 
serviceMetadata.sensorsstringCSV searchable sensor code namesmetadata=minimum 
serviceMetadata.dateFromstringrequested date from in yyyy-MM-ddTHH:mm:ss.SSSZ formatmetadata=minimum 
serviceMetadata.dateTostringrequested date to in yyyy-MM-ddTHH:mm:ss.SSSZ formatmetadata=minimum 
serviceMetadata.metadatastringrequested metadata optionmetadata=minimum 
serviceMetadata.rowLimitintegerrequested row limit per sensor code namemetadata=minimum 
serviceMetadata.outputFormatstringthe requested data output formatmetadata=minimum 
serviceMetadata.totalActualSamplesintegerhow many scalar data expected in total for all the sensorsmetadata=minimum 
serviceMetadata.nextDateFromstringthe date from for next reading in yyyy-MM-ddTHH:mm:ss.SSSZ formatmetadata=minimum 
metadatajson objectmetadata station and device informationmetadata=full 
metadata.stationNamestringstation name for the given station codemetadata=full 
metadata.deviceCategoryNamestringdevice category name for the given category codemetadata=full 
metadata.dateFromstringthe date from for a given deployment in yyyy-MM-ddTHH:mm:ss.SSSZ formatmetadata=full 
metadata.dateTostringthe date to for a given deployment in yyyy-MM-ddTHH:mm:ss.SSSZ formatmetadata=full 
metadata.longitude
double
the aggregate (mean) longitude of the station.metadata=full 
metadata.latitude
double
the aggregate (mean) latitude of the station.metadata=full 
metadata.depth
double
the aggregate (mean) depth of the station.metadata=full 
metadata.bboxjson objectthe boundary of the station boxmetadata=full 
metadata.bbox.minLondoublethe minimum longitude of the station.metadata=full 
metadata.bbox.maxLondoublethe maximum longitude of the station.metadata=full 
metadata.bbox.minLatdoublethe minimum latitude of the station.metadata=full 
metadata.bbox.maxLatdoublethe maximum latitude of the station.metadata=full 
metadata.bbox.minDepthdoublethe minimum depth of the station.metadata=full 
metadata.bbox.maxDepthdoublethe maximum depth of the station.metadata=full 
sensorDataarrayall available scalar data for given time range within the row limitmetadata=minimum 
sensorData.sensorstringsensor code name for a given sensormetadata=minimum 
sensorData.sensorNamestringsensor full name for a given sensormetadata=minimum 
sensorData.unitOfMeasurestringunit of measure name for the scalar readingmetadata=minimum 
sensorData.actualSamplesintegernumber of samples for that sensorDatametadata=minimum 
sensorData.dataarraysensor data for a given sensoroutputFormat=object 
sensorData.data.sampleTimestringtime stamp of the reading in yyyy-MM-ddTHH:mm:ss.SSSZ formatoutputFormat=object 
sensorData.data.valuedoublescalar reading after calibration, derivation and unit conversionoutputFormat=object 
sensordata.data.qaqcFlagintegerQAQC flagoutputFormat=object 
sensorData.datajson objectsensor data for a given sensoroutputFormat=array 
sensorData.data.sampleTimesarrayan array of time stamp of the reading in yyyy-MM-ddTHH:mm:ss.SSSZ formatoutputFormat=array 
sensorData.data.valuesarrayan array of scalar reading after calibration, derivation and unit conversionoutputFormat=array 
sensorData.data.qaqcFlagsarrayan array of QAQC flagsoutputFormat=array 

Note: If the value is null, this may be displayed in the resulting JSON as a null.

 

Example

https://data.oceannetworks.ca/api/scalardata?method=getByStation&token=ffffffff-ffff-ffff-ffff-ffffffffffff&station=SCHDW.O1&deviceCategory=OXYSENSOR

{
	"sensorData": [{
		"actualSamples": 1,
		"data": [{
			"qaqcFlag": 0,
			"sampleTime": "2015-08-20T17:30:53.058Z",
			"value": 23.4859
		}],
		"sensor": "Temperature",
		"sensorName": "Temperature",
		"unitOfMeasure": "C"
	}, {
		"actualSamples": 1,
		"data": [{
			"qaqcFlag": 1,
			"sampleTime": "2015-08-20T17:30:53.058Z",
			"value": 4.417862252
		}],
		"sensor": "oxygen",
		"sensorName": "Oxygen",
		"unitOfMeasure": "ml/l"
	}],
	"serviceMetadata": {
		"dateFrom": null,
		"dateTo": null,
		"deviceCategory": "OXYSENSOR",
		"nextDateFrom": null,
		"outputFormat": null,
		"rowLimit": null,
		"sensors": null,
		"station": "SCHDW.O1",
		"totalActualSamples": 2
	}
}



  • No labels