src.dynamic_boundary_conditions.rainfall.hirds_rainfall_data_from_db

Retrieve all rainfall data for sites within the catchment area from the database.

Attributes

log

Functions

filter_for_duration(→ pandas.DataFrame)

Filter the HIRDS rainfall data for a requested duration.

get_one_site_rainfall_data(→ pandas.DataFrame)

Retrieve rainfall data from the database for the requested site based on the user-requested scenario.

rainfall_data_from_db(→ pandas.DataFrame)

Retrieve rainfall data from the database for sites within the catchment area based on the user-requested scenario.

Module Contents

src.dynamic_boundary_conditions.rainfall.hirds_rainfall_data_from_db.log
src.dynamic_boundary_conditions.rainfall.hirds_rainfall_data_from_db.filter_for_duration(rain_data: pandas.DataFrame, duration: str) pandas.DataFrame

Filter the HIRDS rainfall data for a requested duration.

Parameters:
  • rain_data (pd.DataFrame) – HIRDS rainfall data in Pandas DataFrame format.

  • duration (str) – Storm duration. Valid options are: ‘10m’, ‘20m’, ‘30m’, ‘1h’, ‘2h’, ‘6h’, ‘12h’, ‘24h’, ‘48h’, ‘72h’, ‘96h’, ‘120h’, or ‘all’.

Returns:

Filtered rainfall data for the requested duration.

Return type:

pd.DataFrame

src.dynamic_boundary_conditions.rainfall.hirds_rainfall_data_from_db.get_one_site_rainfall_data(engine: sqlalchemy.engine.Engine, site_id: str, rcp: float | None, time_period: str | None, ari: float, duration: str, idf: bool) pandas.DataFrame

Retrieve rainfall data from the database for the requested site based on the user-requested scenario.

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

  • site_id (str) – HIRDS rainfall site ID.

  • rcp (Optional[float]) – Representative Concentration Pathway (RCP) value. Valid options are 2.6, 4.5, 6.0, 8.5, or None for historical data.

  • time_period (Optional[str]) – Future time period. Valid options are “2031-2050”, “2081-2100”, or None for historical data.

  • ari (float) – Average Recurrence Interval (ARI) value. Valid options are 1.58, 2, 5, 10, 20, 30, 40, 50, 60, 80, 100, or 250.

  • duration (str) – Storm duration. Valid options are: ‘10m’, ‘20m’, ‘30m’, ‘1h’, ‘2h’, ‘6h’, ‘12h’, ‘24h’, ‘48h’, ‘72h’, ‘96h’, ‘120h’, or ‘all’.

  • idf (bool) – Set to False for rainfall depth data, and True for rainfall intensity data.

Returns:

Rainfall data for the requested site based on the user-requested scenario.

Return type:

pd.DataFrame

Raises:

ValueError – If rcp and time_period arguments are inconsistent.

src.dynamic_boundary_conditions.rainfall.hirds_rainfall_data_from_db.rainfall_data_from_db(engine: sqlalchemy.engine.Engine, sites_in_catchment: geopandas.GeoDataFrame, rcp: float | None, time_period: str | None, ari: float, idf: bool = False, duration: str = 'all') pandas.DataFrame

Retrieve rainfall data from the database for sites within the catchment area based on the user-requested scenario.

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

  • sites_in_catchment (gpd.GeoDataFrame) – Rainfall sites coverage areas (Thiessen polygons) that intersect or are within the catchment area.

  • rcp (Optional[float]) – Representative Concentration Pathway (RCP) value. Valid options are 2.6, 4.5, 6.0, 8.5, or None for historical data.

  • time_period (Optional[str]) – Future time period. Valid options are “2031-2050”, “2081-2100”, or None for historical data.

  • ari (float) – Average Recurrence Interval (ARI) value. Valid options are 1.58, 2, 5, 10, 20, 30, 40, 50, 60, 80, 100, or 250.

  • idf (bool = False) – Set to False for rainfall depth data, and True for rainfall intensity data.

  • duration (str = "all") – Storm duration. Valid options are: ‘10m’, ‘20m’, ‘30m’, ‘1h’, ‘2h’, ‘6h’, ‘12h’, ‘24h’, ‘48h’, ‘72h’, ‘96h’, ‘120h’, or ‘all’. Default is ‘all’.

Returns:

A DataFrame containing the rainfall data for sites within the catchment area based on the user-requested scenario.

Return type:

pd.DataFrame