wolfhece.irm_qdf

Author: HECE - University of Liege, Pierre Archambeau Date: 2024

Copyright (c) 2024 University of Liege. All rights reserved.

This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited.

Module Contents

wolfhece.irm_qdf.Montana_a1 = 'a1'[source]
wolfhece.irm_qdf.Montana_a2 = 'a2'[source]
wolfhece.irm_qdf.Montana_a3 = 'a3'[source]
wolfhece.irm_qdf.Montana_b1 = 'b1'[source]
wolfhece.irm_qdf.Montana_b2 = 'b2'[source]
wolfhece.irm_qdf.Montana_b3 = 'b3'[source]
wolfhece.irm_qdf.RT2 = '2'[source]
wolfhece.irm_qdf.RT5 = '5'[source]
wolfhece.irm_qdf.RT10 = '10'[source]
wolfhece.irm_qdf.RT15 = '15'[source]
wolfhece.irm_qdf.RT20 = '20'[source]
wolfhece.irm_qdf.RT25 = '25'[source]
wolfhece.irm_qdf.RT30 = '30'[source]
wolfhece.irm_qdf.RT40 = '40'[source]
wolfhece.irm_qdf.RT50 = '50'[source]
wolfhece.irm_qdf.RT75 = '75'[source]
wolfhece.irm_qdf.RT100 = '100'[source]
wolfhece.irm_qdf.RT200 = '200'[source]
wolfhece.irm_qdf.RT[source]
wolfhece.irm_qdf.freqdep[source]
wolfhece.irm_qdf.freqndep[source]
wolfhece.irm_qdf.dur10min = '10 min'[source]
wolfhece.irm_qdf.dur20min = '20 min'[source]
wolfhece.irm_qdf.dur30min = '30 min'[source]
wolfhece.irm_qdf.dur1h = '1 h'[source]
wolfhece.irm_qdf.dur2h = '2 h'[source]
wolfhece.irm_qdf.dur3h = '3 h'[source]
wolfhece.irm_qdf.dur6h = '6 h'[source]
wolfhece.irm_qdf.dur12h = '12 h'[source]
wolfhece.irm_qdf.dur1d = '1 d'[source]
wolfhece.irm_qdf.dur2d = '2 d'[source]
wolfhece.irm_qdf.dur3d = '3 d'[source]
wolfhece.irm_qdf.dur4d = '4 d'[source]
wolfhece.irm_qdf.dur5d = '5 d'[source]
wolfhece.irm_qdf.dur7d = '7 d'[source]
wolfhece.irm_qdf.dur10d = '10 d'[source]
wolfhece.irm_qdf.dur15d = '15 d'[source]
wolfhece.irm_qdf.dur20d = '20 d'[source]
wolfhece.irm_qdf.dur25d = '25 d'[source]
wolfhece.irm_qdf.dur30d = '30 d'[source]
wolfhece.irm_qdf.durationstext[source]
wolfhece.irm_qdf.durations[source]
wolfhece.irm_qdf.durationsd[source]
wolfhece.irm_qdf.durations[source]
wolfhece.irm_qdf.durations_seconds[source]
class wolfhece.irm_qdf.MontanaIRM(coeff: pandas.DataFrame, time_bounds=None)[source]

Classe pour la gestion des relations de Montana pour les précipitations

coeff[source]
get_ab(dur, T)[source]

Get the Montana coefficients for a given duration and return period

Parameters:
  • dur – the duration, in minutes

  • T – the return period, in years

get_meanrain(dur, T, ab=None)[source]

Get the mean rain for a given duration and return period

Montana formula is i = a * dur^(-b) where a and b are the Montana coefficients for the given duration and return period

Unity of i is [mm/h] and dur is in [minutes]

Parameters:
  • dur – the duration, in minutes

  • T – the return period, in years

  • ab – the Montana coefficients

Returns:

the mean rain in [mm/h]

get_instantrain(dur, T, ab=None)[source]

Get the instantaneous rain for a given duration and return period

Parameters:
  • dur – the duration, in minutes

  • T – the return period, in years

  • ab – the Montana coefficients

Returns:

the instantaneous rain in [mm/h]

get_quantityrain(dur, T)[source]

Get the quantity of rain for a given duration and return period.

The quantity of rain is the mean rain multiplied by the duration expressed in hours (dur/60) to convert it from [mm/h] to [mm]

Parameters:
  • dur – the duration, in minutes

  • T – the return period, in years

Returns:

the quantity of rain in [mm]

get_delta_quantityrain(dur_start, dur_end, T)[source]

Get the difference in quantity of rain between two durations for a given return period.

Parameters:
  • dur_start – the starting duration, in minutes

  • dur_end – the ending duration, in minutes

  • T – the return period, in years

Returns:

the difference in quantity of rain in [mm]

get_delta_meanrain(dur_start, dur_end, T)[source]

Get the difference in mean rain between two durations for a given return period.

Parameters:
  • dur_start – the starting duration, in minutes

  • dur_end – the ending duration, in minutes

  • T – the return period, in years

Returns:

the difference in mean rain in [mm/h]

get_hyetogram_Chicago(total_duration, T, r: Literal['centered', 'left', 'right'] = 'centered')[source]

Get the Chicoago hyetogram for a given return period, a total duration and a decentration coefficient.

The return values are x and y, where x is the starting time of each step of the hyetogram in minutes and y is the intensity of rain for each step of the hyetogram in [mm/h].

x must be interpreted as [x_i, x_{i+1}[ for each step i of the hyetogram, and the intensity y_i is the intensity of rain during this step.

The hyetogram is built as follows: - In centered mode, the peak is located at the middle of the hyetogram and has a duration of 10 minutes - In left mode, the peak is located at the beginning of the hyetogram and has a duration of 10 minutes - In right mode, the peak is located at the end of the hyetogram and has a duration of 10 minutes - The intensity is calculated using the Montana coefficients and the mean rain, to ensure the total quantity of rain is correct - The time step is 5 minutes

Parameters:
  • total_duration – the total duration of the hyetogram, in minutes (must be greater than 10 minutes and a multiple of 5 minutes)

  • T – the return period in years

  • r – Decentration mode, either ‘centered’, ‘left’ or ‘right’

Returns:

x: the starting time of each step of the hyetogram in minutes, y: the intensity of rain for each step of the hyetogram in [mm/h]

get_hyetogram_Chicago_rvar(total_duration, T, r: float = 0.5, timestep: float = 5.0, peak_duration: float = 10.0)[source]

Get the Chicoago hyetogram for a given return period, a total duration and a decentration coefficient.

The return values are x and y, where x is the starting time of each step of the hyetogram in minutes and y is the intensity of rain for each step of the hyetogram in [mm/h].

x must be interpreted as [x_i, x_{i+1}[ for each step i of the hyetogram, and the intensity y_i is the intensity of rain during this step.

The hyetogram is built as follows: - The peak is located at (total_duration * r) and has a duration of peak_duration minutes - The intensity is calculated using the Montana coefficients and the mean rain, to ensure the total quantity of rain is correct - The time step is parameterizable but cosntant for the whole hyetogram, so for example if the time step is 5 minutes, the intensity is calculated every 5 minutes and is constant during these 5 minutes. - if r is not in [0,1,0.5], the hyetogram is computed step-by-step, by alternating steps on the right and left of the peak, to ensure a good resolution around the peak, as the shape of the hyetogram is more important around the peak.

Parameters:
  • total_duration – the total duration of the hyetogram, in minutes (must be greater than 10 minutes and a multiple of 5 minutes)

  • T – the return period in years

  • r – Decentration coefficient, a value in [0, 1] indicating the position of the peak (0 means the peak is at the end of the hyetogram, 1 means the peak is at the beginning of the hyetogram, 0.5 means the peak is in the middle of the hyetogram)

  • timestep – the time step for the hyetogram in minutes

  • peak_duration – the duration of the peak in minutes

Returns:

x: the starting time of each step of the hyetogram in minutes, y: the intensity of rain for each step of the hyetogram in [mm/h]

get_hyetogram_instant(durmax, T, r=0.5, peak_duration=10)[source]

Get the hyetogram for a given return period, a total duration and a decentration coefficient.

The decentration coefficient r is a value in [0, 1] that indicates the position of the peak of the hyetogram. If r is 0, the peak is at the end of the hyetogram. If r is 1, the peak is at the beginning of the hyetogram. If r is 0.5, the peak is in the middle of the hyetogram.

The time step of the hyetogram is variable and is equal to (1-r) minute before the peak and r minute after the peak, to ensure a good resolution around the peak.

The intensity of rain is calculated as the instantaneous rain given by the Montana coefficients, to ensure the correct shape of the hyetogram. The value is picked at the center of each step of the hyetogram, so for example for the step [x_i, x_{i+1}[, the intensity is calculated at (x_i + x_{i+1})/2.

The return values are x and y, where x is the starting time of each step of the hyetogram in minutes and y is the intensity of rain for each step of the hyetogram in [mm/h].

x must be interpreted as [x_i, x_{i+1}[ for each step i of the hyetogram, and the intensity y_i is the intensity of rain during this step.

The hyetogram is built as follows: - The peak is located at (durmax * r) and has a duration of peak_duration minutes - The peak intensity is the mean rain for a duration of peak_duration minutes and the given return period - The shape is discretized with a step of (1-r) minute before the peak and r minute after the peak - The intensity is calculated using the Montana coefficients and the instantaneous rain for each point of the hyetogram

Peak_duration and durmax will be rounded, so the actual peak duration and durmax may be slightly different from the input values.

Parameters:
  • durmax – the maximum duration of the hyetogram, in minutes

  • T – the return period

  • r – Decentration coefficient

  • peak_duration – the duration of the peak, in minutes

plot_hyetogram_instant(durmax, T, r=0.5, figax=None)[source]

Plot the hyetogram for a given return period

Parameters:
  • durmax – the maximum duration of the hyetogram in minutes

  • T – the return period

  • r – Decentration coefficient

plot_hyetogram_Chicago(total_duration, T, r='centered', figax=None)[source]

Plot the Chicago hyetogram for a given return period, a total duration and a decentration coefficient.

Parameters:
  • total_duration – the total duration of the hyetogram in minutes

  • T – the return period

  • r – Decentration mode, either ‘centered’, ‘left’ or ‘right’

plot_hyetogram_Chicago_rvar(total_duration, T, r=0.5, peak_duration=10, timestep=5, figax=None)[source]

Plot the Chicago hyetogram for a given return period, a total duration and a decentration coefficient.

Parameters:
  • total_duration – the total duration of the hyetogram in minutes

  • T – the return period

  • r – Decentration mode, either ‘centered’, ‘left’ or ‘right’

  • peak_duration – the duration of the peak rainfall

  • timestep – the time step for the hyetogram

plot_hyetograms_instant(durmax, r=0.5, figax=None)[source]

Plot the hyetograms for all return periods

Parameters:
  • durmax – the maximum duration of the hyetograms in minutes

  • r – Decentration coefficient

animate_hyetogram_Chicago(total_duration, T, r: float = 0.5, timestep: float = 5.0, peak_duration: float = 10.0, interval: int = 400, figsize: tuple = (18, 5))[source]

Create a matplotlib animation showing the progressive construction of a Chicago hyetogram.

The animation proceeds as follows: 1. Frame 0: empty axes with labels and IDF envelope 2. Frame 1: the peak bar(s) appear 3. Subsequent frames: bars are added alternating right/left of the peak,

exactly mirroring the construction logic of get_hyetogram_Chicago_rvar.

  1. Final frame: the complete hyetogram is shown.

Three panels are displayed: - Left: IDF curve (Montana) with current duration highlighted - Center: hyetogram under construction - Right: QDF curve (Montana) with cumulative volume of placed bars,

showing that the construction respects the total rainfall volume.

Parameters:
  • total_duration – the total duration of the hyetogram in minutes

  • T – the return period in years

  • r – Decentration coefficient in [0, 1]

  • timestep – the time step in minutes

  • peak_duration – the duration of the peak in minutes

  • interval – delay between frames in ms

  • figsize – figure size

Returns:

matplotlib.animation.FuncAnimation

class wolfhece.irm_qdf.Qdf_IRM(store_path=None, code: int = 0, name='', force_import=False, ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018, localities: wolfhece.ins.Localities = None, dataframe: pandas.DataFrame = None, import_as_needed=False)[source]

Gestion des relations QDF calculées par l’IRM

Exemple d’utilisation :

Pour importer les fichiers depuis le site web de l’IRM meteo.be from wolfhece.irm_qdf import Qdf_IRM qdf = Qdf_IRM(force_import=True) qdf =

Il est possible de spécifier le répertoire de stockage des fichiers Excel Par défaut, il s’agit d’un sous-répertoire ‘irm’ du répertoire courant qui sera créé s’il n’exsiste pas

Une fois importé/téléchargé, il est possible de charger une commune sur base de l’INS ou de son nom

myqdf = Qdf_IRM(name=’Jalhay’)

Les données sont ensuite disponibles dans les propriétés, qui sont des “dataframes” pandas (https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) :

  • qdf : les relation Quantité/durée/fréquence

  • standarddev : l’écart-type de l’erreur

  • confintlow : la valeur inférieure de l’intervalle de confiance (-2*stddev)

  • confintup : la valeur supérieure de l’intervalle de confiance (+2*stddev)

  • montanacoeff : les coeffciients de Montana

L’index est le temps (dur10min, dur30min, dur1h, … – durationstext) et les colonnes sont les périodes de retour (RT2, RT5, RT10, … – RT).

Il est par exemple possible d’accéder aux coefficients de Montana via l’une de ces lignes ou une combinaison :

display(myqdf.montanacoeff) rt = myqdf.montanacoeff.index display(myqdf.montanacoeff.loc[rt[0]]) display(myqdf.montanacoeff.iloc[0]) display(myqdf.get_Montanacoeff(qdf.RT2))

Parameters:
  • force_import – If True, will download all the IRM’s QDF files (about 600).

  • import_as_needed – If True and the IRM’s QDF file has not yet been downloaded then the file is downloaded.

qdf = None[source]
standarddev = None[source]
confintlow = None[source]
confintup = None[source]
montanacoeff = None[source]
montana = None[source]
_code = None[source]
_name = None[source]
_qdf_image_table = None[source]
_qdf_image_plot = None[source]
has_data_for_locality() bool[source]

Has this instance been initialized with data from a locality ?

property name[source]
property code[source]
property code_name[source]
property name_code[source]
export_allmontana2xls()[source]

Export all Montana coefficients to an Excel file

classmethod importfromwebsite(store_path: pathlib.Path = 'irm', verbose: bool = False, waitingtime: float = 0.01, ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018, ins_code: int = None)[source]

Import Excel files for one or all municipalities from the IRM website

Parameters:
  • store_path – Where to store the downloaded data. Directory will be created if it doesn’t exist.

  • verbose – If True, will print some progress information. If False, will do nothing. If a callable, then will call it with a float in [0, 1]. 0 means nothing downloaded, 1 means everything downloaded.

  • waitingtime – How long to wait (in seconds) betwenn the download of each station (will make sure we don’t overwhelm IRM’s website).

  • ins – The year of the INS codes to use.

  • code – Restricts the data download to a specific NIS code. None means full download.

classmethod make(ins_code: int | str, store_path: pathlib.Path = None, verbose: bool = False, waitingtime: float = 0.01, ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018)[source]

Make a Qdf_IRM instance with data from the IRM website

Parameters:
  • store_path – Where to store the downloaded data. Directory will be created if it doesn’t exist.

  • verbose – If True, will print some progress information. If False, will do nothing. If a callable, then will call it with a float in [0, 1]. 0 means nothing downloaded, 1 means everything downloaded.

  • waitingtime – How long to wait (in seconds) betwenn the download of each station (will make sure we don’t overwhelm IRM’s website).

  • ins – The year of the INS codes to use.

  • code – Restricts the data download to a specific NIS code. None means full download.

_read_csv_or_excel(code='', name='')[source]

Lecture des caractéristiques d’une commune depuis le fichier CSV ou Excel associé au code INS

Parameters:
  • code – le code INS de la commune

  • name – le nom de la commune

_read_csv_or_excel_Montana_only(code='', name='')[source]

Lecture des caractéristiques d’une commune depuis le fichier CSV Excel associé au code INS

Parameters:
  • code – le code INS de la commune

  • name – le nom de la commune

classmethod convert_xls2csv(store_path='irm', ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018)[source]

Convert all Excel files to CSV files

Parameters:
  • store_path – Where to store the downloaded data. Directory will be created if it doesn’t exists.

  • ins – The year of the INS codes to use.

plot_idf(T=None, which: Literal['All', 'Montana', 'QDFTable'] = 'All', color=[27.0 / 255.0, 136.0 / 255.0, 245.0 / 255.0])[source]

Plot IDF relations on a new figure

:param T : the return period (based on RT constants) :param which : information to plot

  • ‘Montana’

  • ‘QDFTable’

  • ‘All’

plot_qdf(T=None, which: Literal['All', 'Montana', 'QDFTable'] = 'All', color=[27.0 / 255.0, 136.0 / 255.0, 245.0 / 255.0])[source]

Plot QDF relations on a new figure :param T : the return period (based on RT constants) :param which : information to plot

  • ‘Montana’

  • ‘QDFTable’

  • ‘All’

plot_cdf(dur=None)[source]

Plot the cdf of the QDF data for a given duration

fit_all()[source]

Fit all durations with a Generalized Extreme Value distribution

save_fits_json()[source]

Save the fits in a csv file

load_fits_json()[source]

Load the fits from a json file

fit_cdf(dur=None, plot=False)[source]

Fit the cdf of the QDF data with a Generalized Extreme Value distribution

Parameters:
  • dur – the duration to fit

  • plot – if True, will plot the cdf with the fit

get_Tfromrain(Q, dur=dur1h)[source]

Get the return period for a given quantity of rain

Parameters:
  • Q – the quantity of rain

  • dur – the duration

get_rainfromT(T, dur=dur1h)[source]

Get the quantity of rain for a given return period and duration

Parameters:
  • T – the return period

  • dur – the duration

get_MontanacoeffforT(return_period)[source]

Get the Montana coefficients for a given return period

Parameters:

return_period – the return period

plot_hyeto(durmax, T, r=0.5)[source]

Plot the hyetogram for a given return period

Parameters:
  • durmax – the maximum duration of the hyetogram

  • T – the return period

  • r – the decentration coefficient

plot_hyetos(durmax, r=0.5)[source]

Plot the hyetograms for all return periods

Parameters:
  • durmax – the maximum duration of the hyetograms

  • r – the decentration coefficient

make_image_qdf_plot(T=None, which: Literal['All', 'Montana', 'QDFTable'] = 'All', color=[27.0 / 255.0, 136.0 / 255.0, 245.0 / 255.0])[source]

Create an image of the QDF plot.

We use the matplotlib library to create a PNG image of the QDF data. The image will be saved in the store path with the name <code>_qdf_plot.png.

Parameters:
  • durmax – the maximum duration of the hyetograms

  • r – Decentration coefficient

Returns:

a PNG image

make_image_qdf_table()[source]

Create an image of the QDF data.

We use the dataframe_image library to create a PNG image of the QDF data. Added style to the DataFrame to make it more readable.

Returns:

a PNG image

make_images()[source]

Create all images for the QDF data.

property path_image_plot[source]

Get the path for the QDF plot image.

property path_image_table[source]

Get the path for the QDF table image.

class wolfhece.irm_qdf.QDF_Belgium(store_path='irm', ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018, force_import: bool = False)[source]

Class to manage all QDF data for Belgium

localities[source]
store_path[source]
all: dict[int, Qdf_IRM][source]
make_images()[source]

Create all images for all QDF data.

wolfhece.irm_qdf.TRANSLATION_HEADER[source]
wolfhece.irm_qdf.RE_REFERENCE[source]
class wolfhece.irm_qdf.Climate_IRM(store_path='irm', ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018)[source]
store_path[source]
localities[source]
_climate_data[source]
classmethod importfromwebsite(store_path='irm', verbose: bool = False, waitingtime: float = 0.01, ins: Literal['2018', '2019', '2025', 2018, 2019, 2025] = 2018, ins_code: int = None, convert=False)[source]

Import Excel files for one or all municipalities from the IRM website

Parameters:
  • store_path – Where to store the downloaded data. Directory will be created if it doesn’t exists.

  • verbose – If True, will print some progress information. If False, will do nothing. If a callable, then will call it with a float in [0, 1]. 0 means nothing downloaded, 1 means everything downloaded.

  • waitingtime – How long to wait (in seconds) betwenn the download of each station (will make sure we don’t overwhelm IRM’s website).

  • ins – The year of the INS codes to use.

  • code – Restricts the data download to a specific NIS code. None means full download.

  • convert – Converts the downloaded PDF to Excel files.

classmethod _scrap_table(t)[source]

Helper method to transform a table represented as a list of list to a pandas DataFrame.

classmethod _convert_irm_file(pdf_file: str | pathlib.Path)[source]

Scrap a PDF from IRM into two tables in a single Excel file with two sheets.

wolfhece.irm_qdf.PLUVIO_INI = 'pluvio.ini'[source]
wolfhece.irm_qdf.MATCH_NUM_ZONE_SHAPEFILE_INS_INDEX = 'Match_num_zone_shapefile_INS_index.txt'[source]
wolfhece.irm_qdf.EXTREME_PRECIP_COMMUNES = 'Extreme_rain_ins.txt'[source]
wolfhece.irm_qdf.GEOMETRY_MUNICIPALITIES = 'PDS__COMMUNES.shp'[source]
class wolfhece.irm_qdf.QDF_Hydrology(store_path=DATADIR / 'irm_qdf', ini_file: str = PLUVIO_INI, ins: Literal['2018', 2018] = 2018, geometry: str = GEOMETRY_MUNICIPALITIES)[source]

Prepare data from IRM website for WOLF hydrology calculations.

We need : - pluvio.ini - Match_num_zone_shapefile_INS_index.txt

“pluvio.ini” contains the path to the rainfall data files for each locality: - Extreme_precip_communes.txt

store_path[source]
_data: dict[int, Qdf_IRM][source]
_ins = 2018[source]
_extreme_file = 'Extreme_rain_ins.txt'[source]
_nb_lines_extreme_file = 0[source]
_nb_cols_extreme_file = 0[source]
localities[source]
_ini_file = 'pluvio.ini'[source]
_geometry = 'PDS__COMMUNES.shp'[source]
_geometry_df = None[source]
read_data()[source]

Read the data from the ini file and the extreme precipitation file.

download_municipalities_2018(force: bool = False)[source]

Download the municipalities shapefile from HECE.

Parameters:

force – If True, will download the file even if it already exists.

create_match_num_zone_shapefile()[source]

Create the Match_num_zone_shapefile_INS_index.txt file.

This file contains the mapping between the INS codes and the shapefile indices.

create_default_data()[source]

Create data from scratch for WOLF hydrology calculations.

create_extreme_precipitation_file()[source]

Create the extreme precipitation file for all localities.

Each line of the file contains the following data: - INS code - Duration in seconds - Quantity for each return period (RT2, RT5, RT10, RT20, RT50, RT100)

create_ini_file()[source]

Create a parameter file for the class

get_all_ins() list[int][source]

Get a list of all INS codes.

class wolfhece.irm_qdf.QDF_Hydrology_Draw(store_path=DATADIR / 'irm_qdf', ins: Literal['2018', 2018] = 2018, idx: str = '', plotted: bool = True, mapviewer=None)[source]

Bases: wolfhece.drawing_obj.Element_To_Draw

Inheritance diagram of wolfhece.irm_qdf.QDF_Hydrology_Draw

Class to draw the QDF hydrology data on a map.

This class is used to draw the QDF hydrology data on a map using the WOLF hydrology calculations.

_qdf_hydrology[source]
_scale_factor = 1.0[source]
_geometry_zones[source]
_geometry_tables[source]
_geometry_plots[source]
_centroids[source]
_show_table = False[source]
_show_plot = False[source]
_reload_images = True[source]
_current_images = None[source]
_get_vector_tables(ins: str | int) wolfhece.PyVertexvectors.vector[source]

Get the vector for a given INS code.

_get_vector_plots(ins: str | int) wolfhece.PyVertexvectors.vector[source]

Get the vector for a given INS code.

property store_path[source]

Get the store path for the QDF hydrology data.

_prepare_image_location()[source]

Set the default size for the images.

set_images_as_legend(plot_or_table: Literal['plot', 'table'] = 'plot', which: list = None)[source]

Set all images in the collection as legend images.

hide_all_images()[source]

Hide all images in the collection.

check_plot()[source]

Generic function responding to check operation from mapviewer

find_nearest_centroid(x: float, y: float, bounds: tuple[float, float, float, float])[source]

Pick the municipality at the given coordinates.

Parameters:
  • x – The x coordinate.

  • y – The y coordinate.

Returns:

The name of the municipality or an empty string if not found.

pick_municipality(x: float, y: float, bounds: tuple[float, float, float, float])[source]

Activate plot for the nearest municipality to the given coordinates.

find_centroids_in_polygon(polygon: wolfhece.PyVertexvectors.Polygon) list[tuple[wolfhece.PyVertexvectors.vector, str]][source]

Find all centroids in a given polygon.

Parameters:

polygon – A shapely Polygon object defining the area to search.

find_centroid_in_bounds(bounds: tuple[float, float, float, float]) list[tuple[wolfhece.PyVertexvectors.vector, str]][source]

Find all centroids within the given bounds.

Parameters:

bounds – A tuple of (minx, miny, maxx, maxy) defining the bounding box.

property show_plot: bool[source]

Check if the plot is shown.

property show_table: bool[source]

Check if the table is shown.

scale_images(factor: float = 1.0)[source]

Scale the images in the collection by a given factor.

Parameters:

factor – The scaling factor to apply to the images.

plot(sx=None, sy=None, xmin=None, ymin=None, xmax=None, ymax=None, size=None)[source]

Plot the QDF hydrology data on the map.