Learn R Programming

onc.api (version 2.0.1.0)

Oceans 2.0 API Client Library

Description

Allows users to discover and retrieve Ocean Networks Canada's oceanographic data in raw, text, image, audio, video or any other format available. Provides a class that wraps web service calls and business logic so that users can download data with a single line of code.

Copy Link

Version

Install

install.packages('onc.api')

Monthly Downloads

214

Version

2.0.1.0

License

MIT + file LICENSE

Maintainer

Bennit Mueller

Last Published

August 21st, 2021

Functions in onc.api (2.0.1.0)

.formatDuration

Returns a formatted time duration string representation of a duration in seconds
.getListByDevice

Get a list of files available in Oceans 2.0 Archiving System for a given device code. The list of filenames can be filtered by time range. filtered by others optional parameters.
.getDirectFiles

Downloads all archive files that match the filters Internally will use geListByDevice or getListByLocation and getFile all files
.prettyPrint

Pretty prints a complex hierarchy of lists
.getDeployments

Request a list of deployments that matches the filters provided
.getList

A generic wrapper for getListByLocation() and getListByDevice()
.prepareDirectory

Creates directory if it does not exist Supports directory paths with or without filenames
.getDirectByLocation

Obtains scalar data from a location, from the source described by the filters
.formatResult

Aggregates individual download results obtained in .orderDataProduct() into a list of formatted results to return, and a named list with general stats of the operation
.discoveryRequest

Discovery Request encapsulates a request to a discovery service
.filterByExtension

Filter file list results to only those where the filename ends with the extension If extension is empty no change will be made
.getDataProducts

Request a list of data products that matches the filters provided
.infoForProductFiles

Returns a list of information lists for each file available for download Returned rows will have the same structure as those returned by DataProductFile$getInfo()
.filters2url

Returns a string URL for a base url and a named list of parameters
.lastItem

R helper: Returns the last element of a list
.saveAsFile

Saves the file downloaded in the response object, in the outPath, with filename
.getLocations

Request a list of locations that matches the filters provided
.getDeviceCategories

Request a list of device categories that matches the filters provided
.printProductOrderStats

Prints a formatted representation of the total time and size downloaded after the product order finishes
.getDevices

Request a list of devices that matches the filters provided
.getFile

Download the archive file with filename
.getDownloadUrl

Given a filename, returns an archivefile absolute download URL
.formatSize

Returns a formatted file size string representation
.serviceUrl

Returns the absolute url for a given ONC API service
.print

Helper for printing a JSON named list to the console Can alternatively print the output to a text file at filePath
.printErrorMessage

Print Error Response Message
.getProperties

Request a list of properties that matches the filters provided
.orderDataProduct

Request, run and download a data product as described by the filters
.getDirectAllPages

Generic method to download and concatenate all pages of data Keeps downloading all scalar or raw data pages until finished Automatically translates sensorCategoryCodes to a string if a list is provided
.requestDataProduct

Request a data product generation described by the filters
.printProductRequest

Prints the response after a data product request The request response format might differ depending on the product origin as it can be "assembled" on the fly, or reused from existing products
.getDirectByDevice

Obtains scalar data from a device, as described by the filters
.log

Prints message to console only when showInfo is true
.formatUtc

Format date as ISO8601 UTC
.getDirectRawByLocation

Obtains raw data from a location, from the source described by the filters
.getDirectRawByDevice

Obtains raw data from a device, as described by the filters
.getListByLocation

Get a list of files for a given location code and device category code, and filtered by others optional parameters.
.getLocationHierarchy

Request a hierarchical tree list of locations that matches the filters provided
.respFailed

Response has failed
.runDataProduct

Run a data product generation request
.sanitizeBooleans

For all rows in data, enforce that fields expected to have bool values are logical values (fixes API issues with booleans returned as strings)
MultiPage-class

MultiPage
DataProductFile-class

DataProductFile class
.doRequest

Generic request wrapper for making simple web service requests Will return parsed results, even if they are an error description sent by the API Will stop() if the request fails into an error different from 400
.countFilesInProduct

Given a runId, polls the "download" method to count the number of files available Uses HTTP HEAD to avoid downloading the files
.downloadDataProduct

Public wrapper that lets a user download data products manually with a runId Can optionally return just the download links
.downloadProductFiles

Download all data product files for provided run id
.estimatePollPeriod

Sets a poll period adequate to the estimated processing time Longer processing times require longer poll periods to avoid going over maxRetries
Onc-class

Onc Class
.appendList

Helper that appends a list item to a list of lists