Closed kongdd closed 4 years ago
I think replacing the NA
values with zero is useful but beyond of the scope of this package. If you're working with a large out-of-memory raster, one way this can be accomplished is with a VRT file, e.g.:
convert_na_values_to <- 0
vrt1 <- tempfile(fileext = '.vrt')
vrt2 <- tempfile(fileext = '.vrt')
gdalUtils::gdalbuildvrt('myraster.tif', vrt1, vrtnodata = convert_na_values_to)
gdalUtils::gdalbuildvrt(vrt1, vrt2, srcnodata = 'none')
exact_extract(raster(vrt2), polys, 'mean') # NA values will be read as 0
Thank you
So, I caved. There are now default_value
and default_weight
arguments.
I found that NA values is removed arbitrarily. This is not desired for regional ET, GPP statistics. In this situation, NA values should be regarded as zero.
Hope users could have the options to remove NA values or replace them with zero. Or the give the notice in the
exact_extract
description.