Phenometrics

wcpms.wcpms.get_phenometrics(url, cube, latitude, longitude)

Returns in dictionary form all the phenological metrics calculated for the given spatial location, as well as the time series and timeline used.

Parameters:
  • url – The url of the available wcpms service running

  • cube – Dictionary with information about a BDC’s data cubes with collection, start_date, end_date, freq and band.

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

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

Returns:

A phenological metrics object as a dictionary. TimeSeries: A time series object as a dictionary.

Return type:

Phenometrics

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

Retrieves a Phenometrics for S2-16D-2 data product:

>>> from wcpms import *
>>> wcpms_url = WCPMS_EXAMPLE_URL
>>> datacube = cube_query(
...                       collection="S2-16D-2",
...                       start_date="2021-01-01",
...                        end_date="2021-12-31",
...                       freq='16D',
...                       band="NDVI")
>>> pm = get_phenometrics(
...                  url = wcpms_url,
...                  cube = datacube,
...                  latitude=-29.20, longitude= -55.95)
...
>>> pm['phenometrics']
{'aos_v': 2975.66650390625,
 'bse_v': 6233.1669921875,
 'eos_t': '2021-07-13T00:00:00',
 'eos_v': 5489.0,
 ...
 'sos_t': '2021-01-02T00:00:00',
 'sos_v': 7649.0, '
 'vos_t': '2021-12-20T00:00:00',
 'vos_v': 4817.33349609375
}