:py:mod:`wolfhece.irm_qdf` ========================== .. py:module:: wolfhece.irm_qdf .. autoapi-nested-parse:: 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 --------------- .. py:data:: Montana_a1 :value: 'a1' .. py:data:: Montana_a2 :value: 'a2' .. py:data:: Montana_a3 :value: 'a3' .. py:data:: Montana_b1 :value: 'b1' .. py:data:: Montana_b2 :value: 'b2' .. py:data:: Montana_b3 :value: 'b3' .. py:data:: RT2 :value: '2' .. py:data:: RT5 :value: '5' .. py:data:: RT10 :value: '10' .. py:data:: RT15 :value: '15' .. py:data:: RT20 :value: '20' .. py:data:: RT25 :value: '25' .. py:data:: RT30 :value: '30' .. py:data:: RT40 :value: '40' .. py:data:: RT50 :value: '50' .. py:data:: RT75 :value: '75' .. py:data:: RT100 :value: '100' .. py:data:: RT200 :value: '200' .. py:data:: RT .. py:data:: freqdep .. py:data:: freqndep .. py:data:: dur10min :value: '10 min' .. py:data:: dur20min :value: '20 min' .. py:data:: dur30min :value: '30 min' .. py:data:: dur1h :value: '1 h' .. py:data:: dur2h :value: '2 h' .. py:data:: dur3h :value: '3 h' .. py:data:: dur6h :value: '6 h' .. py:data:: dur12h :value: '12 h' .. py:data:: dur1d :value: '1 d' .. py:data:: dur2d :value: '2 d' .. py:data:: dur3d :value: '3 d' .. py:data:: dur4d :value: '4 d' .. py:data:: dur5d :value: '5 d' .. py:data:: dur7d :value: '7 d' .. py:data:: dur10d :value: '10 d' .. py:data:: dur15d :value: '15 d' .. py:data:: dur20d :value: '20 d' .. py:data:: dur25d :value: '25 d' .. py:data:: dur30d :value: '30 d' .. py:data:: durationstext .. py:data:: durations .. py:data:: durationsd .. py:data:: durations .. py:class:: MontanaIRM(coeff: pandas.DataFrame, time_bounds=None) Classe pour la gestion des relations de Montana pour les précipitations .. py:method:: get_ab(dur, T) Get the Montana coefficients for a given duration and return period :param dur: the duration :param T: the return period .. py:method:: get_meanrain(dur, T, ab=None) Get the mean rain for a given duration and return period :param dur: the duration :param T: the return period :param ab: the Montana coefficients .. py:method:: get_instantrain(dur, T, ab=None) Get the instantaneous rain for a given duration and return period :param dur: the duration :param T: the return period :param ab: the Montana coefficients .. py:method:: get_Q(dur, T) Get the quantity of rain for a given duration and return period :param dur: the duration :param T: the return period .. py:method:: get_hyeto(durmax, T, r=0.5) Get the hyetogram for a given return period :param durmax: the maximum duration of the hyetogram :param T: the return period :param r: Decentration coefficient .. py:method:: plot_hyeto(durmax, T, r=0.5) Plot the hyetogram for a given return period :param durmax: the maximum duration of the hyetogram :param T: the return period :param r: Decentration coefficient .. py:method:: plot_hyetos(durmax, r=0.5) Plot the hyetograms for all return periods :param durmax: the maximum duration of the hyetograms :param r: Decentration coefficient .. py:class:: Qdf_IRM(store_path='irm', code: int = 0, name='', force_import=False, ins: Literal[2018, 2019, 2025, 2018, 2019, 2025] = 2018, localities: wolfhece.ins.Localities = None) 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 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)) .. py:property:: name .. py:property:: code .. py:property:: code_name .. py:property:: name_code .. py:method:: has_data_for_locality() -> bool Has this instance been initialized with data from a locality ? .. py:method:: export_allmontana2xls() Export all Montana coefficients to an Excel file .. py:method:: importfromwebsite(store_path='irm', verbose: bool = False, waitingtime: float = 0.01, ins: Literal[2018, 2019, 2025, 2018, 2019, 2025] = 2018, ins_code: int = None) :classmethod: Import Excel files for one or all municipalities from the IRM website :param store_path: Where to store the downloaded data. Directory will be created if it doesn't exists. :param 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. :param waitingtime: How long to wait (in seconds) betwenn the download of each station (will make sure we don't overwhelm IRM's website). :param ins: The year of the INS codes to use. :param code: Restricts the data download to a specific NIS code. `None` means full download. .. py:method:: ins_read_excel(code='', name='') Lecture des caractéristiques d'une commune depuis le fichier Excel associé au code INS .. py:method:: convert_xls2csv(store_path='irm', ins: Literal[2018, 2019, 2025, 2018, 2019, 2025] = 2018) :classmethod: Convert all Excel files to JSON files :param store_path: Where to store the downloaded data. Directory will be created if it doesn't exists. :param ins: The year of the INS codes to use. .. py:method:: plot_idf(T=None, which='All', color=[27.0 / 255.0, 136.0 / 255.0, 245.0 / 255.0]) Plot IDF relations on a new figure :param T : the return period (based on RT constants) :param which : information to plot - 'Montana' - 'QDFTable' - 'All' .. py:method:: plot_qdf(T=None, which='All', color=[27.0 / 255.0, 136.0 / 255.0, 245.0 / 255.0]) Plot QDF relations on a new figure :param T : the return period (based on RT constants) :param which : information to plot - 'Montana' - 'QDFTable' - 'All' .. py:method:: plot_cdf(dur=None) Plot the cdf of the QDF data for a given duration .. py:method:: fit_all() Fit all durations with a Generalized Extreme Value distribution .. py:method:: save_fits_json() Save the fits in a csv file .. py:method:: load_fits_json() Load the fits from a json file .. py:method:: fit_cdf(dur=None, plot=False) Fit the cdf of the QDF data with a Generalized Extreme Value distribution :param dur: the duration to fit :param plot: if True, will plot the cdf with the fit .. py:method:: get_Tfromrain(Q, dur=dur1h) Get the return period for a given quantity of rain :param Q: the quantity of rain :param dur: the duration .. py:method:: get_rainfromT(T, dur=dur1h) Get the quantity of rain for a given return period and duration :param T: the return period :param dur: the duration .. py:method:: get_MontanacoeffforT(return_period) Get the Montana coefficients for a given return period :param return_period: the return period .. py:method:: plot_hyeto(durmax, T, r=0.5) Plot the hyetogram for a given return period :param durmax: the maximum duration of the hyetogram :param T: the return period :param r: the decentration coefficient .. py:method:: plot_hyetos(durmax, r=0.5) Plot the hyetograms for all return periods :param durmax: the maximum duration of the hyetograms :param r: the decentration coefficient .. py:class:: QDF_Belgium(store_path='irm', ins: Literal[2018, 2019, 2025, 2018, 2019, 2025] = 2018)