# Locate and read the polar volume example file
pvolfile <- system.file("extdata", "volume.h5", package = "bioRad")
pvol <- read_pvolfile(pvolfile)
# Calculate linear reflectivity ETA from reflectivity factor DBZH
radar_wavelength <- pvol$attributes$how$wavelength
pvol <- calculate_param(pvol, ETA = dbz_to_eta(DBZH, radar_wavelength))
# Add depolarization ratio (DR) as a scan parameter (see Kilambi 2018)
pvol <- calculate_param(pvol, DR = 10 * log10((ZDR + 1 - 2 * ZDR^0.5 * RHOHV) /
(ZDR + 1 + 2 * ZDR^0.5 * RHOHV)))
# The function also works on scan and ppi objects
calculate_param(example_scan, DR = 10 * log10((ZDR + 1 - 2 * ZDR^0.5 * RHOHV) /
(ZDR + 1 + 2 * ZDR^0.5 * RHOHV)))
# set all reflectivity values to NA when correlation coefficient > 0.95
# (indicating precipitation)
if (require(dplyr, quietly = TRUE)) {
calculate_param(pvol,
DBZH=if_else(c(RHOHV)>.95, NA, c(DBZH)) )
}
# it also works for ppis
ppi <- project_as_ppi(example_scan)
calculate_param(ppi, exp(DBZH))
Run the code above in your browser using DataLab