py3dinterpolations.modelling.interpolate.interpolate
- py3dinterpolations.modelling.interpolate.interpolate(griddata: GridData, model_name: str, grid_resolution: float, model_params: dict = {}, model_params_grid: dict = {}, preprocess_kwags: dict = {}, predict_kwags: dict = {}, return_model: bool = False) Union[ndarray, Tuple[ndarray, Modeler]]
interpolate griddata
Interpolate griddata using a Modeler instance that wraps all supported models. The model is selected with the argument model_name.
If the model_params is passed, then the model is initialized with those parameters. Otherwise, to make a search for the best parameters, use the model_params_grid argument.
The 3D grid for interpolation is retrived from the training data. At the moment features only a regular grid.
If requested, the griddata is preprocessed using the Preprocessor class.
- Parameters
griddata (GridData) – griddata to interpolate
model_name (str) – model name
grid_resolution (float) – grid resolution
model_params (dict, optional) – model parameters. Defaults to {}.
preprocess_kwags (dict, optional) – preprocessing parameters. Defaults to {}.
predict_kwags (dict, optional) – prediction parameters. Defaults to {}.
return_model (bool, optional) – return model. Defaults to False.
- Returns
interpolated griddata, optionally with model
- Return type
Union[np.ndarray, Tuple[np.ndarray, Modeler]]
- Raises
ValueError – either model_params or model_params_grid must be passed
ValueError – model_params and model_params_grid cannot be passed together
NotImplementedError – only RegularGrid3D is supported.
NotImplementedError – Parameter search is only supported for ordinary_kriging
Examples
>>> # interpolate griddata >>> interpolated = interpolate( >>> griddata, >>> model_name="ordinary_kriging", >>> grid_resolution=5, >>> model_params={ >>> "variogram_model": "linear", >>> "nlags": 6, >>> "weight": True, >>> }, >>> preprocess_kwags={ >>> "downsampling_res": 0.1, >>> "normalize_xyz": True, >>> "standardize_v": True, >>> }, >>> )