WTSS
- class wtss.wtss.WTSS(url, validate=False, access_token=None)
Implement a client for WTSS.
Note
For more information about coverage definition, please, refer to WTSS specification.
- __init__(url, validate=False, access_token=None)
Create a WTSS client attached to the given host address (an URL).
- Parameters:
url (str) – URL for the WTSS server.
validate (bool, optional) – If True the client will validate the server response.
access_token (str, optional) – Authentication token to be used with the WTSS server.
- property coverages
Return a list of coverage names.
- Returns:
A list with the names of available coverages in the service.
- Return type:
list
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
- _list_coverages()
List available coverages in the service.
- Returns:
A list with the names of available coverages in the service.
- Return type:
list
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
- _describe_coverage(name)
Get coverage metadata for the given coverage identified by its name.
- Parameters:
name (str) – The coverage name identifier used to retrieve its metadata.
- Returns:
The coverage metadata as a dictionary.
- Return type:
dict
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
- _time_series(**options)
Retrieve the time series for a given location.
- 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:
dict
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
- __getitem__(key)
Get coverage whose name is identified by the key.
- Returns:
A coverage metadata object.
- Return type:
- Raises:
ConnectionError – If the server is not reachable.
HTTPError – If the server response indicates an error.
ValueError – If the response body is not a json document.
Example
Get a coverage object named
MOD13Q1
:>>> from wtss import * >>> service = WTSS(WTSS_EXAMPLE_URL) >>> service['MOD13Q1'] Coverage...
- __getattr__(name)
Get coverage identified by name.
- Returns:
A coverage metadata object.
- Return type:
- Raises:
AttributeError – If a coverage with the given name doesn’t exist or could not be retrieved.
Example
Get a coverage object named
MOD13Q1
:>>> from wtss import * >>> service = WTSS(WTSS_EXAMPLE_URL) >>> service.MOD13Q1 Coverage...