towerpy.calib.calib_rhohv#

Towerpy: an open-source toolbox for processing polarimetric radar data.

Classes#

rhoHV_Calibration

A class for calibrating the correlation coefficient \(\rho_{HV}\).

Functions#

_build_theo_line(snr_centers, rhohv_theo[, mode, ...])

Internal helper for rhohv_noisecorrection.

_rmse_objective(rc, Z, rng_km, rhohv_na, bins_snr, ...)

Internal helper for rhohv_noisecorrection.

_optimise_noise_level(Z, rng_km, rhohv_na[, bins_rho, ...])

Internal helper for rhohv_noisecorrection.

rhohv_noisecorrection(ds[, inp_names, rhohv_theo, ...])

Correct noise-bias in the radar correlation coefficient (rhoHV).

Module Contents#

class towerpy.calib.calib_rhohv.rhoHV_Calibration(radobj=None)[source]#

A class for calibrating the correlation coefficient \(\rho_{HV}\).

Attributes#

elev_anglefloat

Elevation angle at where the scan was taken, in degrees.

file_namestr

Name of the file containing radar data.

scandatetimedatetime

Date and time of scan.

site_namestr

Name of the radar site.

varsdict

Corrected \(\rho_{HV}\) and user-defined radar variables.

elev_angle = None[source]#
file_name = None[source]#
scandatetime = None[source]#
site_name = None[source]#
rhohv_noise_correction(rad_georef, rad_params, rad_vars, mode='exp', exp_curvet=20.0, eps=0.005, rhohv_theo=(0.9, 1.0), noise_level=(0, 100), bins_rho=(0.8, 1.1, 0.005), bins_snr=(5, 30, 0.1), plot_method=False, data2correct=None)[source]#

Applies noise‑bias correction to \(\rho_{HV}\).

Parameters#

rad_georefdict

Georeferenced data containing descriptors of the azimuth, gates and beam height, amongst others.

rad_paramsdict

Radar technical details.

rad_varsdict

Radar variables used for the correction method. The default is None.

data2correctdict, optional

Dictionary to update the corrected \(\rho_{HV}\). The default is None.

Notes#

  1. Based on the method described in [1]_

  2. See the xarray implementation (rhohv_noisecorrection) for more details.

References#

towerpy.calib.calib_rhohv._build_theo_line(snr_centers, rhohv_theo, mode='linear', exp_curvet=20.0, eps=0.005)[source]#

Internal helper for rhohv_noisecorrection.

towerpy.calib.calib_rhohv._rmse_objective(rc, Z, rng_km, rhohv_na, bins_snr, bins_rho, rhohv_theo, mode='linear', exp_curvet=20.0, eps=0.005)[source]#

Internal helper for rhohv_noisecorrection.

towerpy.calib.calib_rhohv._optimise_noise_level(Z, rng_km, rhohv_na, bins_rho=(0.8, 1.1, 0.005), bins_snr=(5, 30, 0.1), rhohv_theo=(0.9, 1.0), noise_level=(0, 100), mode='linear', exp_curvet=20.0, eps=0.005)[source]#

Internal helper for rhohv_noisecorrection.

towerpy.calib.calib_rhohv.rhohv_noisecorrection(ds, inp_names=None, rhohv_theo=(0.9, 1.0), mode='exp', exp_curvet=20.0, eps=0.005, noise_level=(0, 100), bins_rho=(0.8, 1.1, 0.005), bins_snr=(5, 30, 0.1), data2correct=None, preserve_original=True, plot_method=False)[source]#

Correct noise-bias in the radar correlation coefficient (rhoHV).

Parameters#

dsxarray.Dataset

Input dataset containing at least: - reflectivity (e.g. “DBTH”) - range (e.g. “range”) - raw correlation coefficient rhoHV (e.g. “URHOHV”)

inp_namesdict, optional

Mapping of variable names in ds. Keys: {“Z”, “rng”, “rhohv”}. Defaults: {“Z”: “DBTH”, “rng”: “range”, “rhohv”: “URHOHV”}.

bins_rhotuple of float, optional

rhoHV binning interval as (start, stop, step). Default is (0.8, 1.1, 0.005).

bins_snrtuple of float, optional

SNR binning interval as (start, stop, step). Default is (5, 30, 0.1).

rhohv_theotuple of float, optional

Theoretical rhoHV range expected in rain (rhoHV_0, rhoHV_{inf}). Default is (0.90, 1.0).

noise_leveltuple of float, optional

Bounds for radar constant optimisation (min, max). Default is (0, 100).

mode{“linear”, “exp”, “piecewise”}, optional

Functional form of the theoretical rhoHV–SNR curve. Default is “exp”.

exp_curvetfloat, optional

Transition point for “exp” mode. Default is 20.0.

epsfloat, optional

Small tolerance for exponential decay. Default is 0.005.

data2correctxarray.Dataset, optional

If provided, this dataset is updated with corrected rhoHV. If None, a new dataset is created containing RHOHV_corr.

preserve_originalbool, optional

Only applies when data2correct is provided: - True: keep raw rhoHV and add RHOHV_corr - False: overwrite raw rhoHV

plot_methodbool, optional

If True, plots both the optimised diagnostic plot and the calibration grid.

Returns#

xarray.Dataset

Dataset with corrected rhoHV and diagnostic attributes: - noise_level_dB - objective_rmse - rhohv_theo - mode, exp_curvet, eps

Notes#

Based on the method described in [1]_.

References#