pyrad.prod.generate_intercomp_products#

pyrad.prod.generate_intercomp_products(dataset, prdcfg)[source]#
Generates radar intercomparison products. Accepted product types:
‘PLOT_AND_WRITE_INTERCOMP_TS’: Writes statistics of radar

intercomparison in a file and plots the time series of the statistics. Note that in order to use this product you need to also define the product WRITE_INTERCOMP for the dataset in question. User defined parameters:

voltype: str

name of the pyrad variable to use, it must be available in the dataset

add_date_in_fname: Bool

If true adds the year in the csv file containing the statistics. Default False

sort_by_date: Bool

If true sorts the statistics by date when reading the csv file containing the statistics. Default False

step: float

The quantization step of the data. If none it will be computed using the Py-ART config file. Default None

rewrite: Bool

If true rewrites the csv file containing the statistics. Default False

npoints_min: int

The minimum number of points to consider the statistics valid and therefore use the data point in the plotting. Default 0

transform: str

A transform to apply to the data before computing the statistics and generating the plots. Any mathematical function with argument “x” is accepted for example “sin(x) + x**2” or “10 * log10(x)” Default is to use no transform

range_binslist of float, optional

Range bin edges in meters. Separate files and plots are created for every set of range bins. Default is [0, np.inf].

corr_min: float

The minimum correlation to consider the statistics valid and therefore use the data point in the plotting. Default 0.

‘INTERCOMP_HISTOGRAMS’: Plots one-dimensional histograms of colocated intercomparison data from two

radars. The distributions of radar 1 and radar 2 are shown on the same plot, optionally for different range intervals. User defined parameters:

histogram_typestr, optional

Type of histogram product. If set to “cumulative”, the plot is only generated when dataset[“final”] is True. Default is “cumulative”.

range_binslist of float, optional

Range bin edges in meters. One histogram is produced for each range interval. Default is [0, np.inf].

transformstr, optional

Mathematical expression applied to both radar values before plotting. Default is “x”.

stepfloat, optional

Histogram bin width. If None, bin edges are determined automatically.

vmin, vmaxfloat, optional

Minimum and maximum histogram limits. If not specified, limits are inferred from the selected data.

cap_limitsbool, optional

If True, values outside [vmin, vmax] are discarded. If False, values are clipped to the nearest limit. Default is False.

double_conditional_thresholdfloat, optional

If set, only samples where both radar values are larger than this threshold are used.

binwidth_equalbool, optional

If True, histogram bars are shown with equal visual width regardless of the actual bin size. Default is False.

‘PLOT_SCATTER_INTERCOMP’: Plots a density plot (2D histogram) with the points of

radar 1 versus the points of radar 2. Note that in order to use this product you need to also define the product WRITE_INTERCOMP_TIME_AVG for the dataset in question. User defined parameters:

voltype: str

name of the pyrad variable to use, it must be available in the dataset

step: float

The quantization step of the data. If none it will be computed using the Py-ART config file. Default None

vmin: float

Minimum value of the density plot. If vmin or vmax are not defined the range limits of the field as defined in the Py-ART config file are going to be used.

vmax: float

Maximum value of the density plot. If vmin or vmax are not defined the range limits of the field as defined in the Py-ART config file are going to be used.

min_cnt: int

Minimum number of samples in a 2D histogram bin for the bin to be displayed. Default is 0 so all histogram bins with a last one sample are displayed.

bins_transform: str

Either “linear” or “log”. Specifies whether the counts in the colorbar of the scatter-plots are in linear or in log scale. Default is “linear”

cap_limits: bool

If set to 1, all values larger than vmax or smaller than vmin will be discarded from the scatter plot. If set to 0, they will be kept and assigned to the smallest/largest bin of the histogram. Default is 0.

double_conditional_threshold: float

If set a double conditional threshold will be applied in the computation of the scores, e.g. only samples where both radars have measured a value > threshold will be used.

scatter_type: str

Type of scatter plot. Can be a plot for each radar volume (instant) or at the end of the processing period (cumulative). Default is cumulative

marginals: bool

If set to 1, will also plot the two marginal distributions on the sides of the scatter-plot

range_bins: list of floats

Range bins in meters to radar 1 to consider, a different plot will be generated for all range bins. This can be used to differentiate the analysis in different radar ranges. Default is to generate only one figure, regardless of the distance to radar 1.

transform: str

A transform to apply to the data before computing the statistics and generating the plots. Any mathematical function with argument “x” is accepted for example “sin(x) + x**2” or “10 * log10(x)” Default is to use no transform

‘WRITE_INTERCOMP’: Writes the instantaneously intercompared data (gate positions, values, etc.) in a csv file.

Beware that if the file already exists for a given processing day, the data will be appended to the existing file and you might get duplicates. To avoid this delete the existing file first. User defined parameters:

voltype: str

name of the pyrad variable to use, it must be available in the dataset

Parameters:
  • dataset (tuple) – values of colocated gates dictionary

  • prdcfg (dictionary of dictionaries) – product configuration dictionary of dictionaries

Returns:

filename (str) – the name of the file created. None otherwise