imod.select.cross_section_line#

imod.select.cross_section_line(data, start, end)[source]#

Obtain an interpolated cross-sectional slice through gridded data. Utilizing the interpolation functionality in xarray, this function takes a vertical cross-sectional slice along a line through the given data on a regular (possibly non-equidistant) grid, which is given as an xarray.DataArray so that we can utilize its coordinate data.

Adapted from Metpy: https://github.com/Unidata/MetPy/blob/master/metpy/interpolate/slices.py

Parameters
  • data (xarray.DataArray or xarray.Dataset) –

    Three- (or higher) dimensional field(s) to interpolate. The DataArray (or each DataArray in the Dataset) must have been parsed by MetPy and include both an x and y coordinate dimension and the added crs

    coordinate.

  • start ((2, ) array_like) – A latitude-longitude pair designating the start point of the cross section.

  • end ((2, ) array_like) – A latitude-longitude pair designating the end point of the cross section.

Returns

The interpolated cross section, with new dimension “s” along the cross-section. The cellsizes along “s” are given in the “ds” coordinate.

Return type

xarray.DataArray or xarray.Dataset