Request (Near) Real-Time Data

# Get the token from your Oceans 3.0 profile page
from onc import ONC

onc = ONC("YOUR_TOKEN")

/scalardata/location

Get the last scalar data reading available from a device in a location

params = {
    "locationCode": "SEVIP",
    "deviceCategoryCode": "CTD",
    "rowLimit": "1",
    "getLatest": "true",
}

onc.getDirectByLocation(params)

Get 1 minute of time-series scalar data readings from a a device in a location

params = {
    "locationCode": "SEVIP",
    "deviceCategoryCode": "CTD",
    "dateFrom": "2016-09-01T00:00:00.000Z",
    "dateTo": "2016-09-01T00:01:00.000Z",
}

onc.getDirectByLocation(params)

Get 10 seconds of raw CTD data readings from a location

params = {
    "locationCode": "BACAX",
    "deviceCategoryCode": "CTD",
    "dateFrom": "2017-05-23T00:00:00.000Z",
    "dateTo": "2017-05-23T00:00:10.000Z",
}

onc.getDirectRawByLocation(params)["data"]["readings"]

/scalardata/device

Get 10 seconds of raw data readings from a specific device

params = {
    "deviceCode": "AMLMETRECX50348",
    "dateFrom": "2019-06-01T00:00:00.000Z",
    "dateTo": "2019-06-01T00:00:10.000Z",
}

onc.getDirectByDevice(params)

Get 1 minute of time-series scalar data readings from a specific device

params = {
    "deviceCode": "SBECTD19p4686",
    "dateFrom": "2016-09-01T00:00:00.000Z",
    "dateTo": "2016-09-01T00:01:00.000Z",
}

onc.getDirectByDevice(params)