floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input
Generate the requested rainfall model input for BG-Flood, which can be either spatially uniform rain input (‘rain_forcing.txt’ text file) or spatially varying rain input (‘rain_forcing.nc’ NetCDF file).
Attributes
Functions
| 
 | Remove existing rain input files from the specified directory. | 
| 
 | Get the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area, | 
| 
 | Get the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area, | 
| 
 | Calculate the mean catchment rainfall intensities (weighted average of gauge measurements) | 
| 
 | Write the mean catchment rainfall intensities data (i.e., 'seconds' and 'rain_intensity_mmhr' columns) into a | 
| 
 | Create rainfall intensities data cube (xarray data) for the catchment area across all durations, | 
| 
 | Write the rainfall intensities data cube in NetCDF format (rain_forcing.nc). | 
| 
 | Generate the requested rainfall model input for BG-Flood, either spatially uniform rain input | 
Module Contents
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.log
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.remove_existing_rain_inputs(bg_flood_dir: pathlib.Path) None
- Remove existing rain input files from the specified directory. - Parameters:
- bg_flood_dir (pathlib.Path) – BG-Flood model directory containing the rain input files. 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.sites_voronoi_intersect_catchment(sites_in_catchment: geopandas.GeoDataFrame, catchment_area: geopandas.GeoDataFrame) geopandas.GeoDataFrame
- Get the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area, returning the overlapping areas. - Parameters:
- sites_in_catchment (gpd.GeoDataFrame) – Rainfall sites coverage areas (Thiessen Polygons) that intersect or are within the catchment area. 
- catchment_area (gpd.GeoDataFrame) – A GeoDataFrame representing the catchment area. 
 
- Returns:
- A GeoDataFrame containing the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area. 
- Return type:
- gpd.GeoDataFrame 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.sites_coverage_in_catchment(sites_in_catchment: geopandas.GeoDataFrame, catchment_area: geopandas.GeoDataFrame) geopandas.GeoDataFrame
- Get the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area, and calculate the size and percentage of the catchment area covered by each rainfall site. - Parameters:
- sites_in_catchment (gpd.GeoDataFrame) – Rainfall sites coverage areas (Thiessen Polygons) that intersect or are within the catchment area. 
- catchment_area (gpd.GeoDataFrame) – A GeoDataFrame representing the catchment area. 
 
- Returns:
- A GeoDataFrame containing the intersection of the rainfall sites coverage areas (Thiessen Polygons) and the catchment area, with calculated size and percentage of the catchment area covered by each rainfall site. 
- Return type:
- gpd.GeoDataFrame 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.mean_catchment_rainfall(hyetograph_data: pandas.DataFrame, sites_coverage: geopandas.GeoDataFrame) pandas.DataFrame
- Calculate the mean catchment rainfall intensities (weighted average of gauge measurements) across all durations using the Thiessen polygon method. - Parameters:
- hyetograph_data (pd.DataFrame) – Hyetograph intensities data for sites within the catchment area. 
- sites_coverage (gpd.GeoDataFrame) – A GeoDataFrame containing information about the coverage area of each rainfall site within the catchment area, including the size and percentage of the catchment area covered by each site. 
 
- Returns:
- A DataFrame containing the mean catchment rainfall intensities across all durations. 
- Return type:
- pd.DataFrame 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.spatial_uniform_rain_input(hyetograph_data: pandas.DataFrame, sites_coverage: geopandas.GeoDataFrame, bg_flood_dir: pathlib.Path) None
- Write the mean catchment rainfall intensities data (i.e., ‘seconds’ and ‘rain_intensity_mmhr’ columns) into a text file named ‘rain_forcing.txt’. This file is used as spatially uniform rain input for the BG-Flood model. - Parameters:
- hyetograph_data (pd.DataFrame) – Hyetograph intensities data for sites within the catchment area. 
- sites_coverage (gpd.GeoDataFrame) – A GeoDataFrame containing information about the coverage area of each rainfall site within the catchment area, including the size and percentage of the catchment area covered by each site. 
- bg_flood_dir (pathlib.Path) – BG-Flood model directory. 
 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.create_rain_data_cube(hyetograph_data: pandas.DataFrame, sites_coverage: geopandas.GeoDataFrame) xarray.Dataset
- Create rainfall intensities data cube (xarray data) for the catchment area across all durations, i.e. convert rainfall intensities vector data into rasterized xarray data. - Parameters:
- hyetograph_data (pd.DataFrame) – Hyetograph intensities data for sites within the catchment area. 
- sites_coverage (gpd.GeoDataFrame) – A GeoDataFrame containing information about the coverage area of each rainfall site within the catchment area, including the size and percentage of the catchment area covered by each site. 
 
- Returns:
- Rainfall intensities data cube in the form of xarray dataset. 
- Return type:
- xr.Dataset 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.spatial_varying_rain_input(hyetograph_data: pandas.DataFrame, sites_coverage: geopandas.GeoDataFrame, bg_flood_dir: pathlib.Path) None
- Write the rainfall intensities data cube in NetCDF format (rain_forcing.nc). This file is used as spatially varying rain input for the BG-Flood model. - Parameters:
- hyetograph_data (pd.DataFrame) – Hyetograph intensities data for sites within the catchment area. 
- sites_coverage (gpd.GeoDataFrame) – A GeoDataFrame containing information about the coverage area of each rainfall site within the catchment area, including the size and percentage of the catchment area covered by each site. 
- bg_flood_dir (pathlib.Path) – BG-Flood model directory. 
 
 
- floodresilience.dynamic_boundary_conditions.rainfall.rainfall_model_input.generate_rain_model_input(hyetograph_data: pandas.DataFrame, sites_coverage: geopandas.GeoDataFrame, bg_flood_dir: pathlib.Path, input_type: floodresilience.dynamic_boundary_conditions.rainfall.rainfall_enum.RainInputType) None
- Generate the requested rainfall model input for BG-Flood, either spatially uniform rain input (‘rain_forcing.txt’ text file) or spatially varying rain input (‘rain_forcing.nc’ NetCDF file). - Parameters:
- hyetograph_data (pd.DataFrame) – Hyetograph intensities data for sites within the catchment area. 
- sites_coverage (gpd.GeoDataFrame) – A GeoDataFrame containing information about the coverage area of each rainfall site within the catchment area, including the size and percentage of the catchment area covered by each site. 
- bg_flood_dir (pathlib.Path) – BG-Flood model directory. 
- input_type (RainInputType) – The type of rainfall model input to be generated. Valid options are ‘uniform’ or ‘varying’, representing spatially uniform rain input (text file) or spatially varying rain input (NetCDF file).