grid2grid¶
-
emg3d.maps.
grid2grid
(grid, values, new_grid, method='linear', extrapolate=True, log=False)[source]¶ Interpolate values located on grid to new_grid.
Note 1: The default method is ‘linear’, because it works with fields and model parameters. However, recommended are ‘volume’ for model parameters and ‘cubic’ for fields.
Note 2: For model parameters with method=’volume’ the result is quite different if you provide resistivity, conductivity, or the logarithm of any of the two. The recommended way is to provide the logarithm of resistivity or conductivity, in which case the output of one is indeed the inverse of the output of the other.
Parameters: - grid, new_grid : TensorMesh
Input and output model grids;
TensorMesh
instances.- values : ndarray
Model parameters;
emg3d.fields.Field
instance, or a particular field (e.g. field.fx). For fields the method cannot be ‘volume’.- method : {<’linear’>, ‘volume’, ‘cubic’}, optional
The method of interpolation to perform. The volume averaging method ensures that the total sum of the property stays constant.
Volume averaging is only implemented for model parameters, not for fields. The method ‘cubic’ requires at least three points in any direction, otherwise it will fall back to ‘linear’.
Default is ‘linear’, because it works with fields and model parameters. However, recommended are ‘volume’ for model parameters and ‘cubic’ for fields.
- extrapolate : bool
If True, points on new_grid which are outside of grid are filled by the nearest value (if
method='cubic'
) or by extrapolation (ifmethod='linear'
). If False, points outside are set to zero.For
method='volume'
it always uses the nearest value for points outside of grid.Default is True.
- log : bool
If True, the interpolation is carried out on a log10-scale; hence the same as
10**grid2grid(grid, np.log10(values), ...)
. Default is False.
Returns: - new_values : ndarray
Values corresponding to new_grid.
See also
get_receiver
- Interpolation of model parameters or fields to (x, y, z).