From 8047d6161b96c3233a75361bbd98b56d585bc2c0 Mon Sep 17 00:00:00 2001 From: adokter Date: Mon, 3 Jun 2024 12:06:41 -0400 Subject: [PATCH] set expected eta to zero when scan reflectivity is NA --- R/integrate_to_ppi.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/integrate_to_ppi.R b/R/integrate_to_ppi.R index 104b075d3..d2bc1fb82 100644 --- a/R/integrate_to_ppi.R +++ b/R/integrate_to_ppi.R @@ -331,6 +331,11 @@ add_expected_eta_to_scan <- function(scan, vp, quantity = "dens", param = "DBZH" attributes(eta_expected)$param <- "eta_expected" scan$params$eta_expected <- eta_expected + # set eta_expected values to zero whenever the reflectivity quantity is NA + # NA values indicate the pixel was never irradiated, so no reflectivity return expected + na_idx <- is.na(scan$params[[param]]) & !is.nan(scan$params[[param]]) + scan$params[["eta_expected"]][na_idx] <- 0 + # return the scan with added scan parameters 'eta' and 'eta_expected' scan }