pyrad.prod.generate_timeseries_products#
- pyrad.prod.generate_timeseries_products(dataset, prdcfg)[source]#
- Generates time series products. Accepted product types:
‘POINT_TS’: Writes and plots point time series for one or multiple radars.
It generates a CSV file containing the time series values at a single point or radar gate. If multiple radar entries are present in the dataset, all radar series are written to the same CSV file and plotted together in one figure. If the timestamps of the different radars don’t agree an outer join will be performed and missing timestamps will be filled with NaNs
- User defined parameters:
- set_time_info: bool
If True, date information is added to the output directory and filenames. Default is True.
- do_only_final: bool
If True, the product is only generated when dataset[‘final’] is True. Default is True.
- RadarName: list of str
Names of the radars to use as plot labels. The order should match the RADAR entries in the dataset.
- basepath: str
Base path where the product output directory is created.
- procname: str
Processing name used to build the output directory.
- dstype: str
Dataset type used in the output filename.
- imgformat: list of str
List of image formats to generate.
- dpi: int
Figure resolution in dots per inch. Default is 72.
- vmin: float or None
Minimum y-axis value used in the plot. If None, the limit is determined automatically.
- vmax: float or None
Maximum y-axis value used in the plot. If None, the limit is determined automatically.
- label: str
Optional label added to the plot title.
- ‘COMPARE_POINT_SENSOR’: Plots and/or compares radar and co-located gauge (sensor)
data at a point of interest. The product always writes a combined CSV file containing both radar and sensor data. Optionally, the radar and sensor time series can be time-averaged or time-accumulated to a user-defined interval (if no interval is provided, native sampling is used). The plot can be either a dual time series comparison or a scatter plot of radar vs sensor. User defined parameters:
- set_time_info: bool
If True, date information is added to the output directory and filenames. Default is True.
- do_only_final: bool
If True, the product is only generated when dataset[‘final’] is True. Default is True.
- dpi: int
The pixel density of the plot. Default 72
- vmin, vmax: float
The limits of the Y-axis. If none they will be obtained from the Py-ART config file.
- plot_type: str
The type of plot to generate. Can be ‘timeseries’ (default) or ‘scatter’. Scatter-plots also show the RMSE, corr and bias.
- double_conditional_threshold: float
When using plot_type == “scatter”, the data can be filtered with a double-conditional threshold. Default is -infinity (no thresholding)
- time_interval: int or None
Time interval in seconds used to resample both radar and sensor series before comparison. If None, the native timestamps are used.
- agg_mode: str
The aggregation method used when time_interval is set. Can be ‘mean’ (time-averaging) or ‘sum’ (time-accumulation). Default ‘mean’.
- align: str
How to align radar and sensor timestamps when producing paired values (used for CSV pairing and scatter plots). Can be ‘nearest’ (default) or ‘inner’. ‘inner’ requires that the timestamps of the radar and gauge match perfectly.
- nearest_tol: int or None
Maximum allowed time difference in seconds when align=’nearest’. If None, no tolerance is applied (nearest_tol = infinity), which is not recommended when there are holes in the radar timeseries, as it will lead to erroneous interpolation.
- sensor: str
The sensor type. Can be ‘rgage’, ‘rgage_knmi’ or ‘disdro’
- sensorid: str
The sensor ID.
- varname: str
Name of the variable to use in the sensor files. It corresponds to the column you want to compare with your radar measurements.
- sensor_scaling: float
Scaling factor for the sensor data. Use 6 for example to convert from mm for 10-min measurements to mm/hr (which is the radar reference). Default is 1 (no scaling)
- dir_template: str
The directory template where to find the file. dir_template should be a directory template string (relative to rgpath/disdropath or absolute) that can contain {sensorid} and any strftime date format codes (e.g. %Y, %m, %d, %Y%m%d, optionally written as {%Y%m%d}), which will be expanded using the provided sensorid and date before performing the recursive search, for example “{%Y-%m-%d}/{sensorid}/” If not provided a potentially deep recursive search will be performed which can take some time.
- ‘COMPARE_SCORES_SENSOR’: Computes performance scores using sensor data as a reference and radar
data as the estimate. It will generate a csv file containing the daily scores for one or multiple radars (if present) as well as update a plot of the time series of performance scores over time. User defined parameters:
- scores: list of str
Which scores to compute, currently the following are supported: - corr (pearson correlation) - RMSE (root mean square error) - logBias (bias in log scale) - scatter (see https://doi.org/10.1256/qj.05.190) Default is RMSE and corr
- bounds: list of float
If set will compute the scores in the specified bounds based on the sensor value. e.g. 0,1,10 will compute the scores in the [0,1] and [1,10] will be computed separately and will be written to the csv file. If not provided no bounds will be used
- double_conditional_threshold: float
Optionally a double conditional threshold can be applied in the computation of the scores e.g. only points where both the estimate and the reference exceed this threshold will be used in the score computation
- time_interval: int or None
Time interval in seconds used to resample both radar and sensor series before comparison. If None, the native timestamps are used.
- agg_mode: str
The aggregation method used when time_interval is set. Can be ‘mean’ (time-averaging) or ‘sum’ (time-accumulation). Default ‘mean’.
- align: str
How to align radar and sensor timestamps when producing paired values (used for CSV pairing and scatter plots). Can be ‘nearest’ (default) or ‘inner’. ‘inner’ requires that the timestamps of the radar and gauge match perfectly.
- nearest_tol: int or None
Maximum allowed time difference in seconds when align=’nearest’. If None, no tolerance is applied (nearest_tol = infinity), which is not recommended when there are holes in the radar timeseries, as it will lead to erroneous interpolation.
- sensor: str
The sensor type. Can be ‘rgage’, ‘rgage_knmi’ or ‘disdro’
- sensorid: str
The sensor ID.
- varname: str
Name of the variable to use in the sensor files. It corresponds to the column you want to compare with your radar measurements.
- sensor_scaling: float
Scaling factor for the sensor data. Use 6 for example to convert from mm for 10-min measurements to mm/hr (which is the radar reference). Default is 1 (no scaling)
- dir_template: str
The directory template where to find the file. dir_template should be a directory template string (relative to rgpath/disdropath or absolute) that can contain {sensorid} and any strftime date format codes (e.g. %Y, %m, %d, %Y%m%d, optionally written as {%Y%m%d}), which will be expanded using the provided sensorid and date before performing the recursive search, for example “{%Y-%m-%d}/{sensorid}/” If not provided a potentially deep recursive search will be performed which can take some time.
- ‘PLOT_AND_WRITE_TRAJ’: Writes and plots a trajectory time series.
- User defined parameters:
- voltype: str
name of the pyrad variable to use, it must be available in the dataset
- ymin, ymax: float
The minimum and maximum value of the Y-axis. If none it will be obtained from the Py-ART config file.
- ‘PLOT_HIST_TRAJ’: plots and writes a histogram of all the data gathered
during the trajectory processing User defined parameters:
- voltype: str
name of the pyrad variable to use, it must be available in the dataset
- step: float or None
The quantization step of the data. If None it will be obtained from the Py-ART config file
- ‘CAPPI_IMAGE_TRAJ’: Creates a CAPPI image with the trajectory position
overplot on it. User defined parameters:
- voltype: str
name of the pyrad variable to use, it must be available in the dataset
- color_ref: str
The meaning of the color code with which the trajectory is plotted. Can be ‘None’, ‘altitude’ (the absolute altitude), ‘rel_altitude’ (altitude relative to the CAPPI altitude), ‘time’ (trajectory time respect of the start of the radar scan leading to the CAPPI)
- altitude: float
The CAPPI altitude [m]
- wfunc: str
Function used in the gridding of the radar data. The function types are defined in pyart.map.grid_from_radars. Default ‘NEAREST’
- res: float
The CAPPI resolution [m]. Default 500.
- ‘WRITE_MULTIPLE_POINTS’: Writes a csv file containing data from
multiple points obtained from a radar object
- ‘WRITE_MULTIPLE_POINTS_GRID’: Writes a csv file containing data from
multiple points obtained from a grid object
- Parameters:
dataset (dictionary) – radar object
prdcfg (dictionary of dictionaries) – product configuration dictionary of dictionaries
- Returns:
no return