sl.spatialfilter.getweights | R Documentation |
Compute spatial filter weights for a field on an unstructured grid on a sphere.
sl.spatialfilter.getweights(lon, lat, neighmat, areas, Rsphere = 1, method = "gauss", gauss.sigma = 2 * pi * Rsphere/360, cutoff = 3 * gauss.sigma)
lon |
a vector of length |
lat |
a vector of length |
neighmat |
an |
areas |
a vector of length |
Rsphere |
the radius of the sphere. |
method |
a character specifying the filter type: one of |
gauss.sigma |
the |
cutoff |
the distance at which the filter is truncated. |
This function generates filter weights and the corresponding source and destination index information for an unstructured mesh on a sphere. Implemented filters are the Gaussian filter, a linear filter, and a constant (i.e., running mean) filter. In each case the filter weights take grid point areas (the areas for which the grid point values are assumed to hold) into account. This implies that, e.g., in case of the constant filter the weights are in fact not constant but proportional to the areas.
The argument cutoff
is also used to define where the linear filter assumes zero if method='lin'
, and determines the level of the constant (although area-weighted) weights if method='const'
.
It is M = n * N
where n
, in the range [1,N], is the average number of source points for each destination point. For the identity filter, it is n=1
and all weights equal 1
. For an untruncated filter it is n=N
, but that's not recommended as the generation of the filter - and in particular its subsequent application - will be slowed down very much.
The generated filter information can be applied to a numerical field on the corresponding grid using sl.spatialfilter
. However, the filter information has (not accidentally) the same format as used by the Climate Data Operators (CDO
) and can be written to a NetCDF file that can be used with CDO
to filter large amounts of data much faster than with spheRlab
. A corresponding function to write the output into NetCDF still needs to be added.
A list with the following three elements:
src_address |
an integer vector of length |
dst_address |
an integer vector of length |
filter_weights |
an integer vector of length |
A function that facilitates writing the resulting filter information into a CDO
-readable NetCDF file needs to be added to spheRlab
asap.
Helge Goessling
sl.spatialfilter
## To be provided ...
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.