Aggregating to another, coarser domain
upscale.Rd
Change resolution/geometry of a geofield by averaging.
Usage
upscale(infield, factor=NULL, newdomain=NULL, method="mean", weights=0, ...)
upscale_factor(infield, factor, method="mean", ...)
upscale_regrid(infield, newdomain, method="mean", weights=NULL, ...)
upscale_regrid_init(olddomain, newdomain)
Arguments
- infield
A
geofield
object.- factor
If given, the new grid is simply a coarser version of the original.
factor
should be a vector of 2 integers (if it is scalar, the value is repeated). It dscribes how many gridd cells in the X and Y direction are aggregated to one new grid box.- newdomain, olddomain
A
geodomain
or ageofield
. In the second case only the domain attribute is used.- method
The aggregation method. When aggregating by a given factor, this could be a function like
mean
,median
,max
... For ergridding, only 'mean' is supported.- weights
Initialised weights for faster computation, output from
upscale_regrid_init
. Only used for regridding (factor=NULL).- ...
Options for the method (e.g.
na.rm=TRUE
).
Details
These routines aggregate all grid boxes of the original domain into the new domain. When a factor is used, the result is exactly as expected. When regridding to a different domain, the average is taken of all original cells whose center falls inside the new grid cell. There is no compensation (yet?) for partial grid cells.