salem.Grid.lookup_transform¶
-
Grid.
lookup_transform
(data, grid=None, method=<function mean>, lut=None, return_lut=False)[source]¶ Performs the forward transformation of gridded data into self.
This method is suitable when the data grid is of higher resolution than
self
.lookup_transform
performs aggregation of data according to a user given rule (e.g.np.mean
,len
,np.std
), applied to all grid points found below a grid point inself
.See also
Grid.grid_lookup()
and examples in the docsParameters: - data : ndarray
an ndarray of dimensions 2, 3, or 4, the two last ones being y, x.
- grid : Grid
a Grid instance matching the data
- method : function, default: np.mean
the aggregation method. Possibilities: np.std, np.median, np.sum, and more. Use
len
to count the number of grid points!- lut : ndarray, optional
computing the lookup table can be expensive. If you have several operations to do with the same grid, set
lut
to an existing table obtained from a previous call toGrid.grid_lookup()
- return_lut : bool, optional
set to True if you want to return the lookup table for later use. in this case, returns a tuple
Returns: - An aggregated ndarray of the data, in ``self`` coordinates.
- If ``return_lut==True``, also return the lookup table