API documentation

ai.cdas

The module implements an interface to the REST API of NASA CDAweb.

Refer to CDAS RESTful Web Services (https://cdaweb.gsfc.nasa.gov/WebServices/REST/) for detailed description of parameters.

exception ai.cdas.NoDataError[source]

The exception that is raised when no data is found on the server.

ai.cdas.get_data(dataview, dataset, startTime, stopTime, variables, cdf=False, progress=True)[source]

Queries server (and data cache) for data.

Parameters:
  • dataview (string) – Dataview.
  • dataset (string) – Dataset.
  • startTime (datatime) – First datetime for the requested data.
  • stopTime (datetime) – Last datetime for the requested data.
  • variables (list) – list of strings representing IDs of requested variables.
  • cdf (bool, optional) – If True uses CDF data format for download, otherwise downloads in ASCII format. Defaults to False.
  • progress (bool, optional) – If True displays the download progress bar. Defaults to True.
Returns:

Dictionary of data arrays or sequences.

Return type:

(dict)

ai.cdas.get_datasets(dataview, observatoryGroup=None, instrumentType=None, observatory=None, instrument=None, startDate=None, stopDate=None, idPattern=None, labelPattern=None, notesPattern=None)[source]

Queries server for descriptions of the datasets.

Parameters:
  • dataview (string) – Dataview.
  • observatoryGroup (string, optional) – Observatory group.
  • instrumentType (string, optional) – Instrument type.
  • observatory (string, optional) – Observatory.
  • instrument (string, optional) – Instrument.
  • startDate (datetime, optional) – Start date.
  • stopDate (datetime, optional) – Stop date.
  • idPattern (string, optional) – Id pattern.
  • labelPattern (string, optional) – Label pattern.
  • notesPattern (string, optional) – Notes pattern.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_dataviews()[source]

Queries server for descriptions of dataviews.

Returns:JSON response from the server.
Return type:(dict)
ai.cdas.get_instrument_types(dataview, observatory=None, observatoryGroup=None)[source]

Queries server for descriptions of instrument types.

Parameters:
  • dataview (string) – Dataview.
  • observatory (string, optional) – Observatory.
  • observatoryGroup (string, optional) – Observatory group.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_instruments(dataview, observatory=None)[source]

Queries server for descriptions of the instruments.

Parameters:
  • dataview (string) – Dataview.
  • Observatory (string, optional) – Observatory.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_inventory(dataview, dataset)[source]

Queries server for descriptions of the data inventory within a dataset.

Parameters:
  • dataview (string) – Dataview.
  • dataset (string) – Dataset.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_observatories(dataview, instrument=None, instrumentType=None)[source]

Queries server for descriptions of the observatories.

Parameters:
  • dataview (string) – Dataview.
  • instrument (string, optional) – Instrument.
  • instrumentType (string, optional) – Instrument type.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_observatory_groups(dataview, instrumentType=None)[source]

Queries server for descriptions of observatory groups.

Parameters:
  • dataview (string) – Dataview.
  • instrumentType (string, optional) – Instrument type.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_observatory_groups_and_instruments(dataview, instrumentType=None)[source]

Queries server for descriptions of observatory groups (and associated instruments). This is a convenience/performance alternative to making multiple calls to get_observatory_groups, get_observatories, and get_instruments.

Parameters:
  • dataview (string) – Dataview.
  • instrumentType (string, optional) – Instrument type.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.get_variables(dataview, dataset)[source]

Queries server for descriptions of variables in a dataset.

Parameters:
  • dataview (string) – Dataview.
  • dataset (string) – Dataset.
Returns:

JSON response from the server.

Return type:

(dict)

ai.cdas.set_cache(cache, directory=None)[source]

Sets the data cache.

Parameters:
  • cache (bool) – Flag for switching caching on/off.
  • directory (string, optional) – Path to the cache directory.