act.discovery.download_data

act.discovery.download_data(username, token, datastream, startdate, enddate, time=None, output=None)[source]

This tool will help users utilize the ARM Live Data Webservice to download ARM data.

Parameters:
  • username (str) – The username to use for logging into the ADC archive.

  • token (str) – The access token for accessing the ADC archive.

  • datastream (str) – The name of the datastream to acquire.

  • startdate (str) – The start date of the data to acquire. Formats accepted are YYYY-MM-DD, DD.MM.YYYY, DD/MM/YYYY, YYYYMMDD, YYYY/MM/DD or any of the previous formats with THH:MM:SS added onto the end (ex. 2020-09-15T12:00:00).

  • enddate (str) – The end date of the data to acquire. Formats accepted are YYYY-MM-DD, DD.MM.YYYY, DD/MM/YYYY, YYYYMMDD or YYYY/MM/DD, or any of the previous formats with THH:MM:SS added onto the end (ex. 2020-09-15T13:00:00).

  • time (str or None) – The specific time. Format is HHMMSS. Set to None to download all files in the given date interval.

  • output (str) – The output directory for the data. Set to None to make a folder in the current working directory with the same name as datastream to place the files in.

Returns:

files (list) – Returns list of files retrieved

Notes

This programmatic interface allows users to query and automate machine-to-machine downloads of ARM data. This tool uses a REST URL and specific parameters (saveData, query), user ID and access token, a datastream name, a start date, and an end date, and data files matching the criteria will be returned to the user and downloaded.

By using this web service, users can setup cron jobs and automatically download data from /data/archive into their workspace. This will also eliminate the manual step of following a link in an email to download data. All other data files, which are not on the spinning disk (on HPSS), will have to go through the regular ordering process. More information about this REST API and tools can be found on ARM Live.

To login/register for an access token click here.

Author: Michael Giansiracusa Email: giansiracumt@ornl.gov

Web Tools Contact: Ranjeet Devarakonda zzr@ornl.gov

Examples

This code will download the netCDF files from the sgpmetE13.b1 datastream and place them in a directory named sgpmetE13.b1. The data from 14 Jan to 20 Jan 2017 will be downloaded. Replace userName and XXXXXXXXXXXXXXXX with your username and token for ARM Data Discovery. See the Notes for information on how to obtain a username and token.

act.discovery.download_data(
    "userName", "XXXXXXXXXXXXXXXX", "sgpmetE13.b1", "2017-01-14", "2017-01-20"
)