src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds

Fetch rainfall data from the HIRDS website.

Classes

BlockStructure

Represents the layout structure of fetched rainfall data.

Functions

get_site_url_key(→ str)

Get the unique URL key of the requested rainfall site from the HIRDS website.

get_data_from_hirds(→ str)

Fetch rainfall data for the requested rainfall site from the HIRDS website.

get_layout_structure_of_data(→ List[BlockStructure])

Get the layout structure of the fetched rainfall data.

convert_to_tabular_data(→ pandas.DataFrame)

Convert the fetched rainfall data for the requested site into a Pandas DataFrame.

Module Contents

src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds.get_site_url_key(site_id: str, idf: bool) str

Get the unique URL key of the requested rainfall site from the HIRDS website.

Parameters:
  • site_id (str) – HIRDS rainfall site ID.

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

Returns:

Unique URL key of the requested rainfall site.

Return type:

str

src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds.get_data_from_hirds(site_id: str, idf: bool) str

Fetch rainfall data for the requested rainfall site from the HIRDS website.

Parameters:
  • site_id (str) – HIRDS rainfall site ID.

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

Returns:

Rainfall data for the requested site as a string.

Return type:

str

class src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds.BlockStructure

Bases: NamedTuple

Represents the layout structure of fetched rainfall data.

skip_rows

Number of lines to skip at the start of the fetched rainfall site_data.

Type:

int

rcp

There are four different representative concentration pathways (RCPs), and abbreviated as RCP2.6, RCP4.5, RCP6.0 and RCP8.5, in order of increasing radiative forcing by greenhouse gases, or nan for historical data.

Type:

Optional[float]

time_period

Rainfall estimates for two future time periods (e.g. 2031-2050 or 2081-2100) for four RCPs, or None for historical data.

Type:

Optional[str]

category

Historical data, Historical Standard Error or Projections (i.e. hist, hist_stderr or proj).

Type:

str

skip_rows: int
rcp: float | None
time_period: str | None
category: str
src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds.get_layout_structure_of_data(site_data: str) List[BlockStructure]

Get the layout structure of the fetched rainfall data.

Parameters:

site_data (str) – Fetched rainfall data text string from the HIRDS website for the requested rainfall site.

Returns:

List of BlockStructure named tuples representing the layout structure of the fetched rainfall data.

Return type:

List[BlockStructure]

src.dynamic_boundary_conditions.rainfall.rainfall_data_from_hirds.convert_to_tabular_data(site_data: str, site_id: str, block_structure: BlockStructure) pandas.DataFrame

Convert the fetched rainfall data for the requested site into a Pandas DataFrame.

Parameters:
  • site_data (str) – Fetched rainfall data text string from the HIRDS website for the requested rainfall site.

  • site_id (str) – HIRDS rainfall site ID.

  • block_structure (BlockStructure) – The layout structure of the fetched rainfall data, containing skip rows, RCP, time period, and category.

Returns:

Rainfall data for the requested site in tabular format.

Return type:

pd.DataFrame