rainforest.qpe package
rainforest.qpe.evaluation
: module that deals with evaluation of QPE products
rainforest.qpe.qpe
: main module that computes RF QPE realizations
rainforest.qpe.qpe_compute
: command-line utility to compute RF QPE
rainforest.qpe.qpe_evaluation
: command-line utility to evaluate QPE products
rainforest.qpe.qpe_plot
: command-line utility to plot QPE products
rainforest.qpe.evaluation module
Main function to evaluate QPE runs with gauge data
Daniel Wolfensberger MeteoSwiss/EPFL daniel.wolfensberger@epfl.ch December 2019
- rainforest.qpe.evaluation.evaluation(qpefolder, gaugepattern, list_models=None, outputfolder='./', t0=None, t1=None, bounds10=[0, 2, 10, 100], bounds60=[0, 1, 10, 100])
PErforms an evaluation of QPE products with reference gauge data
- Parameters:
qpefolder (str) – Main directory where the QPE data is stored, each model corresponding to a subfolder, as given by qpe_compute.py
gaugepattern (str) – The pattern of gauge files that contain the gauge data. on CSCS: ‘/store/msrad/radar/radar_database/gauge/*.csv.gz’
t0 (datetime.datetime instance) – starting time of the time range, default is first timestep available
t1 (datetime.datetime instance) – end time of the time range, default is last timestep available
bounds10 (list of float) – list of precipitation bounds for which to compute scores separately at 10 min time resolution [0,2,10,100] will give scores in range [0-2], [2-10] and [10-100]
bounds60 (list of float) – list of precipitation bounds for which to compute scores separately at hourly time resolution [0,1,10,100] will give scores in range [0-1], [1-10] and [10-100]
list_models (list of str) – list of models to use in the evaluation, default is to use all subfolders (models) available in qpefolder
rainforest.qpe.qpe module
Main function to compute the QPE estimations on the Swiss grid
Daniel Wolfensberger MeteoSwiss/EPFL daniel.wolfensberger@epfl.ch December 2019
Modified by D. Wolfensberger and R. Gugerli December 2022
- class rainforest.qpe.qpe.QPEProcessor(config_file, models, rt=False, verbose=True)
Bases:
object
Creates a QPEProcessor object which can be used to compute QPE realizations with the RandomForest Regressors
- Parameters:
config (str) – A yaml file containing all necessary options for the QPE algorithm check the default_config.yml file to see which keys are required
models (dict) – A dictionary containing all RF models to use for prediction, keys in this dictionary are used to store outputs in separate folders whereas the values must be valid RF regressor instances as stored in the rf_models subfolder
rt (bool) – Whether or not to run the model in real-time mode
- compute(output_folder, t0, t1, timestep=5, basename='RFO%y%j%H%MVH', test_mode=False)
Computes QPE values for a given time range and stores them in a folder, in a binary format
- Parameters:
output_folder (str) – Folder where to store the computed QPE fields, note that subfolders for every model will be created in this folder
t0 (datetime) – Start time of the timerange in datetime format
t1 (datetime) – End time of the timerange in datetime format
timestep (int (optional)) – In case you don’t to generate a new product every 5 minute, you can change the time here, f.ex. 10 min, will compute the QPE only every two sets of radar scans
basename (str (optional)) – Pattern for the filenames, default is ‘RFQ%y%j%H%M’ which uses the same standard as other MeteoSwiss products (example RFQ191011055), in real-time version, it is ‘RFQ%y%j%H%MVH’
test_mode (bool) – Is used only in github actions CI with special data for unit tests, should always be set to false
- fetch_data(t0, t1=None)
Retrieves and add new polar radar and status data to the QPEProcessor for a given time range
- Parameters:
t0 (datetime) – Start time of the timerange in datetime format
t1 (datetime) – End time of the timerange in datetime format, will not be used if rt mode is on, as in this case only data for t0 will be obtained
- fetch_data_test(t0, t1)
Fetch the data for a qpe run on the cloud, to be used for unit tests only
- save_features(features, features_labels, t, filepath)
- save_output(qpe, tstamp, filepath)
Saves output as defined in config file
- Parameters:
qpe (array) – Precipitation estimates on grid
tstamp (datetime object) – timestep of QPE
filepath (str) – Destination where file is saved
rainforest.qpe.qpe_compute module
Command line script for the RandomForest QPE
see qpe_compute
- rainforest.qpe.qpe_compute.main()
rainforest.qpe.qpe_evaluation module
Command line script to evaluate a set of QPE realizations using gauge data as reference
see qpe_evaluation
- rainforest.qpe.qpe_evaluation.main()
rainforest.qpe.qpe_plot module
Command line script to display QPE realisazions
see qpe_plot
- rainforest.qpe.qpe_plot.main()