Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #658 (continued) #685

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* correct type of gap field in vpts objects for profiles stored in ODIM HDF5 format (.h5) (#635, #691)

* interpret NA values in field DBZH in integrate_to_ppi() as pixels that were not irradiated (#658)

# bioRad 0.8.1

## bugfixes
Expand Down
15 changes: 9 additions & 6 deletions R/integrate_to_ppi.R
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,10 @@ integrate_to_ppi <- function(pvol, vp, nx = 100, ny = 100, xlim, ylim, zlim = c(
})
output <- rasters[[1]]
}
eta_expected_sum <- rowSums(
do.call(cbind,
lapply(1:length(rasters), function(i) (rasters[[i]]$eta_expected))),
na.rm = TRUE)
eta_expected_sum <-
rowSums(do.call(cbind, lapply(1:length(rasters), function(i) (rasters[[i]]$eta_expected))), na.rm = TRUE)
eta_sum <-
rowSums(do.call(cbind, lapply(1:length(rasters), function(i)
(rasters[[i]]$eta))), na.rm = TRUE)
rowSums(do.call(cbind, lapply(1:length(rasters), function(i) (rasters[[i]]$eta))), na.rm = TRUE)
output@data$eta_sum_expected <- eta_expected_sum
output@data$eta_sum <- eta_sum
output@data$R <- eta_sum / eta_expected_sum
Expand Down Expand Up @@ -511,6 +508,12 @@ add_expected_eta_to_scan <- function(scan, vp, quantity = "dens",
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
}
Loading