Coverage

class wtss.coverage.Coverage(service, metadata=None)

A class that describes a coverage in WTSS.

Note

For more information about coverage definition, please, refer to WTSS specification.

__init__(service, metadata=None)

Create a coverage object associated to a WTSS client.

Parameters:
  • service (wtss.wtss.WTSS) – The client to be used by the coverage object.

  • metadata (dict) – The coverage metadata.

property attributes

Return the list of coverage attributes.

property crs

Return the coordinate reference system metadata.

property description

Return the coverage description.

property dimensions

Return the coverage dimensions metadata.

property name

Return the coverage name.

property spatial_extent

Return the coverage spatial extent.

property spatial_resolution

Return the coverage spatial resolution metadata.

property timeline

Return the coverage timeline.

ts(**options)

Retrieve the time series for a given location and time interval.

Keyword Arguments:
  • attributes (optional) – A string with attribute names separated by commas, or any sequence of strings. If omitted, the values for all coverage attributes are retrieved.

  • longitude (int/float) – A longitude value according to EPSG:4326.

  • latitude (int/float) – A latitude value according to EPSG:4326.

  • start_date (str, optional) – The begin of a time interval.

  • end_date (str, optional) – The begin of a time interval.

Returns:

A time series object as a dictionary.

Return type:

TimeSeries

Raises:
  • HTTPError – If the server response indicates an error.

  • ValueError – If the response body is not a json document.

  • ImportError – If Maptplotlib or Numpy can no be imported.

Example

Retrieves a time series for MODIS13Q1 data product:

>>> from wtss import *
>>> service = WTSS(WTSS_EXAMPLE_URL)
>>> coverage = service['MOD13Q1']
>>> ts = coverage.ts(attributes=('red', 'nir'),
...                  latitude=-12.0, longitude=-54.0,
...                  start_date='2001-01-01', end_date='2001-12-31')
...
>>> ts.red
[236.0, 289.0, ..., 494.0, 1349.0]