imod.mf6.StorageCoefficient.regrid_like#
- StorageCoefficient.regrid_like(target_grid: DataArray | UgridDataArray, regrid_cache: RegridderWeightsCache, regridder_types: RegridMethodType | None = None) Package #
Creates a package of the same type as this package, based on another discretization. It regrids all the arrays in this package to the desired discretization, and leaves the options unmodified. At the moment only regridding to a different planar grid is supported, meaning
target_grid
has different"x"
and"y"
or differentcell2d
coords.The default regridding methods are specified in the
_regrid_method
attribute of the package. These defaults can be overridden using the input parameters of this function.Examples
To regrid the npf package with a non-default method for the k-field, call regrid_like with these arguments:
>>> regridder_types = imod.mf6.regrid.NodePropertyFlowRegridMethod(k=(imod.RegridderType.OVERLAP, "mean")) >>> new_npf = npf.regrid_like(like, RegridderWeightsCache, regridder_types)
- Parameters:
target_grid (xr.DataArray or xu.UgridDataArray) – a grid defined over the same discretization as the one we want to regrid the package to.
regrid_cache (RegridderWeightsCache, optional) – stores regridder weights for different regridders. Can be used to speed up regridding, if the same regridders are used several times for regridding different arrays.
regridder_types (RegridMethodType, optional) – dictionary mapping arraynames (str) to a tuple of regrid type (a specialization class of BaseRegridder) and function name (str) this dictionary can be used to override the default mapping method.
- Returns:
a package with the same options as this package, and with all the data-arrays regridded to another discretization,
similar to the one used in input argument “target_grid”