hestia_earth.utils.lookup.extract_grouped_data_closest_date

hestia_earth.utils.lookup.extract_grouped_data_closest_date(data, year)[source]

Extract date value from a grouped data in a lookup table.

Example: - with data: 2000:-;2001:0.1;2002:0;2003:0;2004:0;2005:0 - get the value for 2001 = 0.1

Parameters
  • data (str) – The data to parse. Must be a string in the format <key1>:<value>;<key2>:<value>

  • year (int) – The year to extract the data. If not present, the closest date data will be returned.

Returns

The closest value found.

Return type

str