exactextractr
exactextractr copied to clipboard
weighted_mean on raster with NAs
Trying to exact_extract() on a netcdf using a tiff as weights returns NaN for the majority of regions except for really small ones, suggesting that the function is failing if there are NAs on the input netcdf/Raster. Simple mean/median working flawlessly.
Is this the expected behavior? Since there is no "na.rm=TRUE" or the likes when using weighted_mean, how can I proceed if either the data or weights raster contain missing pixels?
NA
values in the primary raster are always ignored. NA
values in the weighting raster propagate to the result. To avoid this, you can set the default_weight
argument.
Thanks, DBaston. The default behavior and "deafult_weight" was not obvious to me from the docs. Understood it now.