src.dynamic_boundary_conditions.rainfall.thiessen_polygons

Calculate the area covered by each rainfall site throughout New Zealand and store it in the database. Retrieve the coverage areas (Thiessen polygons) for all rainfall sites located within the catchment area.

Attributes

log

Functions

get_sites_within_aoi(→ geopandas.GeoDataFrame)

Get all rainfall sites within the area of interest from the database and return the required data as a

thiessen_polygons_calculator(→ geopandas.GeoDataFrame)

Create Thiessen polygons for rainfall sites within the area of interest and calculate the area covered by each

thiessen_polygons_to_db(→ None)

Store the data representing the Thiessen polygons, site information, and the area covered by

thiessen_polygons_from_db(→ geopandas.GeoDataFrame)

Get rainfall sites coverage areas (Thiessen polygons) that intersect or are within the catchment area.

Module Contents

src.dynamic_boundary_conditions.rainfall.thiessen_polygons.log
src.dynamic_boundary_conditions.rainfall.thiessen_polygons.get_sites_within_aoi(engine: sqlalchemy.engine.Engine, area_of_interest: geopandas.GeoDataFrame) geopandas.GeoDataFrame

Get all rainfall sites within the area of interest from the database and return the required data as a GeoDataFrame.

Parameters:
  • engine (Engine) – The engine used to connect to the database.

  • area_of_interest (gpd.GeoDataFrame) – A GeoDataFrame representing the area of interest.

Returns:

A GeoDataFrame containing the rainfall sites within the area of interest.

Return type:

gpd.GeoDataFrame

src.dynamic_boundary_conditions.rainfall.thiessen_polygons.thiessen_polygons_calculator(area_of_interest: geopandas.GeoDataFrame, sites_in_aoi: geopandas.GeoDataFrame) geopandas.GeoDataFrame

Create Thiessen polygons for rainfall sites within the area of interest and calculate the area covered by each rainfall site.

Parameters:
  • area_of_interest (gpd.GeoDataFrame) – A GeoDataFrame representing the area of interest.

  • sites_in_aoi (gpd.GeoDataFrame) – Rainfall sites within the area of interest.

Returns:

A GeoDataFrame containing the Thiessen polygons, site information, and area covered by each rainfall site.

Return type:

gpd.GeoDataFrame

Raises:

ValueError

  • If the provided ‘area_of_interest’ GeoDataFrame does not contain any data.

  • If the provided ‘sites_in_aoi’ GeoDataFrame does not contain any data.

src.dynamic_boundary_conditions.rainfall.thiessen_polygons.thiessen_polygons_to_db(engine: sqlalchemy.engine.Engine) None

Store the data representing the Thiessen polygons, site information, and the area covered by each rainfall site in the database.

Parameters:

engine (Engine) – The engine used to connect to the database.

Returns:

This function does not return any value.

Return type:

None

src.dynamic_boundary_conditions.rainfall.thiessen_polygons.thiessen_polygons_from_db(engine: sqlalchemy.engine.Engine, catchment_area: geopandas.GeoDataFrame) geopandas.GeoDataFrame

Get rainfall sites coverage areas (Thiessen polygons) that intersect or are within the catchment area.

Parameters:
  • engine (Engine) – The engine used to connect to the database.

  • catchment_area (gpd.GeoDataFrame) – A GeoDataFrame representing the catchment area.

Returns:

A GeoDataFrame containing the rainfall sites coverage areas (Thiessen polygons) that intersect or are within the catchment area.

Return type:

gpd.GeoDataFrame