deafrica_tools.waterbodies#

Loading and processing DE Africa Water Bodies data. Last modified: November 2023

Functions

display_time_series([wb_timeseries])

Displays the timeseries as an interactive plot

get_geohashes([bbox, crs])

Gets all waterbody geohashes.

get_time_series([geohash, waterbody, ...])

Gets the time series for a waterbody.

get_water_quality_rankings([geohash, waterbody])

Gets the annual water quality rankings for a waterbody.

get_water_quality_summary([geohash, ...])

Gets the annual water quality summaries for a waterbody.

get_waterbodies(bbox[, crs])

Gets the polygons and metadata for multiple water bodies by bbox.

get_waterbody(geohash)

Gets a waterbody polygon and metadata by geohash.

plot_last_valid_obs(waterbodies)

Plot the waterbodies in based on the value in the "last_valid_obs" column.

deafrica_tools.waterbodies.display_time_series(wb_timeseries: pandas.DataFrame = None) → None#

Displays the timeseries as an interactive plot

Parameters:

wb_timeseries (pd.DataFrame) – A time series for the waterbody.

Return type:

None

deafrica_tools.waterbodies.get_geohashes(bbox: tuple = None, crs: str = 'EPSG:4326') → list[str]#

Gets all waterbody geohashes.

Parameters:
  • bbox ((xmin, ymin, xmax, ymax)) – Optional bounding box.

  • crs (str) – Optional CRS for the bounding box.

Returns:

A list of geohashes.

Return type:

[str]

deafrica_tools.waterbodies.get_time_series(geohash: str = None, waterbody: pandas.Series = None, start_date: str = '1984-01-01', end_date: str = '2026-10-07') → pandas.DataFrame#

Gets the time series for a waterbody. Specify either a GeoDataFrame row or a geohash.

Parameters:
  • geohash (str) – The geohash/uid for a waterbody in DE Africa Water Bodies.

  • waterbody (pd.Series) – One row of a GeoDataFrame representing a waterbody.

  • start_date (str) – Start date for the time range to filter the timeseries to.

  • end_date (str) – End date for the time range to filter the timeseries to.

Returns:

A time series for the waterbody.

Return type:

pd.DataFrame

deafrica_tools.waterbodies.get_water_quality_rankings(geohash: str = None, waterbody: pandas.Series = None) → pandas.DataFrame#

Gets the annual water quality rankings for a waterbody. Specify either a GeoDataFrame row or a geohash.

Parameters:
  • geohash (str) – The geohash/uid for a waterbody in DE Africa Water Bodies.

  • waterbody (pd.Series) – One row of a GeoDataFrame representing a waterbody.

Returns:

A time series for the waterbody.

Return type:

pd.DataFrame

deafrica_tools.waterbodies.get_water_quality_summary(geohash: str = None, waterbody: pandas.Series = None, start_date: str = '2000-01-01', end_date: str = '2026-10-07') → pandas.DataFrame#

Gets the annual water quality summaries for a waterbody. Specify either a GeoDataFrame row or a geohash.

Parameters:
  • geohash (str) – The geohash/uid for a waterbody in DE Africa Water Bodies.

  • waterbody (pd.Series) – One row of a GeoDataFrame representing a waterbody.

  • start_date (str) – Start date for the time range to filter the timeseries to.

  • end_date (str) – End date for the time range to filter the timeseries to.

Returns:

A time series for the waterbody.

Return type:

pd.DataFrame

deafrica_tools.waterbodies.get_waterbodies(bbox: tuple, crs: str = 'EPSG:4326') → geopandas.GeoDataFrame#

Gets the polygons and metadata for multiple water bodies by bbox.

Parameters:
  • bbox ((xmin, ymin, xmax, ymax)) – Bounding box.

  • crs (str) – Optional CRS for the bounding box.

Returns:

A GeoDataFrame with the polygons and metadata.

Return type:

gpd.GeoDataFrame

deafrica_tools.waterbodies.get_waterbody(geohash: str) → geopandas.GeoDataFrame#

Gets a waterbody polygon and metadata by geohash.

Parameters:

geohash (str) – The geohash/uid for a waterbody in DE Africa Water Bodies.

Returns:

A GeoDataFrame with the polygon.

Return type:

gpd.GeoDataFrame

deafrica_tools.waterbodies.plot_last_valid_obs(waterbodies: geopandas.GeoDataFrame)#

Plot the waterbodies in based on the value in the “last_valid_obs” column. :param waterbodies: Waterbodies to plot :type waterbodies: gpd.GeoDataFrame