from onc.onc import ONC
onc = ONC('YOUR_TOKEN_HERE') # Replace YOUR_TOKEN_HERE with your personal token obtained from the 'Web Services API' tab at https://data.oceannetworks.ca/Profile when logged in.
outPath = 'c:\ONC\data'
locationCode = 'NEP' # Northeast Pacific Ocean
deviceCategoryCode = 'HYDROPHONE'
beginDT = '2017-07-16T00:00:00.000Z'
endDT = '2017-07-22T23:59:59.999Z'
dataProductCode = 'AD' # Audio data
extension = 'wav'; # Wave File Format
locations = onc.getLocations({'deviceCategoryCode':deviceCategoryCode,
'locationCode':locationCode,
'deploymentBegin':beginDT,
'deploymentEnd':endDT,
'includeChildren':'true'})
for location in locations:
locationCode = location['locationCode']
print(locationCode)
onc.outPath = "{}/{}".format(outPath,locationCode)
ret = onc.orderDataProduct({'locationCode':locationCode,
'deviceCategoryCode':deviceCategoryCode,
'dataProductCode':dataProductCode,
'extension':extension,
'begin':beginDT,
'end':endDT,
'dpo_hydrophoneDataDiversionMode':'All'},50) |