This method currently has limited functionality for spatial interpolation. It will be extended in the future.
The spatial parameters available depend on the geometry of the Dataset:
Grid1D: x
Grid2D: x, y
Grid3D: [not yet implemented!]
GeometryFM: (x,y)
GeometryFMLayered: (x,y) [surface point will be returned!]
Parameters
Name
Type
Description
Default
time
(float, pd.DatetimeIndex or DataArray)
timestep in seconds or discrete time instances given by pd.DatetimeIndex (typically from another DataArray da2.time), by default None (=don’t interp in time)
None
x
float
x-coordinate of point to be interpolated to, by default None
None
y
float
y-coordinate of point to be interpolated to, by default None
None
z
float
z-coordinate of point to be interpolated to, by default None
None
n_nearest
int
When using IDW interpolation, how many nearest points should be used.
required
interpolant
tuple
Precomputed interpolant, by default None
required
**kwargs
Any
Additional keyword arguments to be passed to the interpolation
{}
Returns
Name
Type
Description
DataArray
new DataArray with interped data
See Also
sel : Select data using label indexing interp_like : Interp to another time/space of another DataArray interp_time : Interp in the time direction only
pd.DatetimeIndex | DataArray | Dataset | int | float
output timestep in seconds or new time axis
required
method
str
Specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘previous’, ‘next’, where ‘zero’, ‘slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of zeroth, first, second or third order; ‘previous’ and ‘next’ simply return the previous or next value of the point) or as an integer specifying the order of the spline interpolator to use. Default is ‘linear’.
'linear'
extrapolate
bool
Default True. If False, a ValueError is raised any time interpolation is attempted on a value outside of the range of x (where extrapolation is necessary). If True, out of bounds values are assigned fill_value
True
fill_value
float
Default NaN. this value will be used to fill in for points outside of the time range.
Return a new DataArray whose data is given by integer indexing along the specified dimension(s).
Note that the data will be a view of the original data if possible (single index or slice), otherwise a copy (fancy indexing) following NumPy convention.
The spatial parameters available depend on the dims (i.e. geometry) of the DataArray:
Grid1D: x
Grid2D: x, y
Grid3D: x, y, z
GeometryFM: element
Parameters
Name
Type
Description
Default
idx
IndexType
Index, or indices, along the specified dimension(s)
None
axis
Any
axis number or “time”, by default 0
0
time
int
time index,by default None
None
x
int
x index, by default None
None
y
int
y index, by default None
None
z
int
z index, by default None
None
layer
IndexType
layer index, only used in dfsu 3d
None
direction
IndexType
direction index, only used in sprectra
None
frequency
IndexType
frequencey index, only used in spectra
None
node
IndexType
node index, only used in spectra
None
element
int
Bounding box of coordinates (left lower and right upper) to be selected, by default None
None
Returns
Name
Type
Description
DataArray
new DataArray with selected data
See Also
dims : Get axis names sel : Select data using labels
Examples
da = mikeio.read("../data/europe_wind_long_lat.dfs2")[0]da
Note: on unstructured meshes with variable element sizes, mean(axis="space") treats all elements equally regardless of area. For an area-weighted spatial mean, use average() with weights=geometry.get_element_area().
Parameters
Name
Type
Description
Default
axis
int | str | None
axis number or “time” or “space”, by default 0
0
**kwargs
Any
Additional keyword arguments
{}
Returns
Name
Type
Description
DataArray
array with mean values
See Also
nanmean : Mean values with NaN values removed
average : Weighted average along an axis
min
DataArray.min(axis=0, **kwargs)
Min value along an axis.
Parameters
Name
Type
Description
Default
axis
int | str
axis number or “time” or “space”, by default 0
0
**kwargs
Any
Additional keyword arguments
{}
Returns
Name
Type
Description
DataArray
array with min values
See Also
nanmin : Min values with NaN values removed
nanmax
DataArray.nanmax(axis=0, **kwargs)
Max value along an axis (NaN removed).
Parameters
Name
Type
Description
Default
axis
int | str
axis number or “time” or “space”, by default 0
0
**kwargs
Any
Additional keyword arguments
{}
Returns
Name
Type
Description
DataArray
array with max values
See Also
nanmax : Max values with NaN values removed
nanmean
DataArray.nanmean(axis=0, **kwargs)
Unweighted mean value along an axis (NaN removed).
Note: on unstructured meshes with variable element sizes, nanmean(axis="space") treats all elements equally regardless of area. For an area-weighted spatial mean, use average() with weights=geometry.get_element_area().
Parameters
Name
Type
Description
Default
axis
int | str | None
axis number or “time” or “space”, by default 0
0
**kwargs
Any
Additional keyword arguments
{}
Returns
Name
Type
Description
DataArray
array with mean values
See Also
mean : Mean values
average : Weighted average along an axis
nanmin
DataArray.nanmin(axis=0, **kwargs)
Min value along an axis (NaN removed).
Parameters
Name
Type
Description
Default
axis
int | str
axis number or “time” or “space”, by default 0
0
**kwargs
Any
Additional keyword arguments
{}
Returns
Name
Type
Description
DataArray
array with min values
See Also
nanmin : Min values with NaN values removed
nanquantile
DataArray.nanquantile(q, *, axis=0, **kwargs)
Compute the q-th quantile of the data along the specified axis, while ignoring nan values.
Wrapping np.nanquantile
Parameters
Name
Type
Description
Default
q
float | Sequence[float]
Quantile or sequence of quantiles to compute, which must be between 0 and 1 inclusive.
Return a new DataArray whose data is given by selecting index labels along the specified dimension(s).
In contrast to DataArray.isel, indexers for this method should use labels instead of integers.
The spatial parameters available depend on the geometry of the DataArray:
Grid1D: x
Grid2D: x, y, coords, area
Grid3D: [not yet implemented! use isel instead]
GeometryFM: (x,y), coords, area
GeometryFMLayered: (x,y,z), coords, area, layers
Parameters
Name
Type
Description
Default
time
(str, pd.DatetimeIndex, DataArray)
time labels e.g. “2018-01” or slice(“2018-1-1”,“2019-1-1”), by default None
None
x
float
x-coordinate of point to be selected, by default None
None
y
float
y-coordinate of point to be selected, by default None
None
z
float
z-coordinate of point to be selected, by default None
None
coords
np.array(float, float)
As an alternative to specifying x, y and z individually, the argument coords can be used instead. (x,y)- or (x,y,z)-coordinates of point to be selected, by default None
None
area
bbox, polygon or shapely geometry
Area to be selected: a bounding box (left, lower, right, upper), a list of (x, y) polygon vertices, or (flexible mesh only) a Polygon or MultiPolygon with __geo_interface__, e.g. from shapely or geopandas, holes excluded. Elements are selected when their centre is inside the area or on its boundary. By default None
None
layers
int or str or list
layer(s) to be selected: “top”, “bottom” or layer number from bottom 0,1,2,… or from the top -1,-2,… or as list of these; only for layered dfsu, by default None
None
Returns
Name
Type
Description
DataArray
new DataArray with selected data
See Also
isel : Select data using integer indexing interp : Interp data in time and space