xoa.interp.isoslice

Contents

xoa.interp.isoslice#

xoa.interp.isoslice(da, values, isoval, dim, reverse=False, dask='parallelized', **kwargs)[source]#

Extract a slice of da where values equals isoval

Interpolates da along dim at the position where values crosses isoval.

Parameters:
  • da (xarray.DataArray) – Array from which the data are extracted.

  • values (xarray.DataArray) – Array in which isoval is searched for.

  • isoval (float, xarray.DataArray) – Target value to locate in values.

  • dim (str) – Dimension shared by da and values along which the slice is performed.

  • reverse (bool) – If True, search from the end of the dim axis instead of from the beginning.

  • dask (str) – Unused, kept for compatibility.

  • kwargs (dict) – Unused, kept for compatibility.

Returns:

xarray.DataArray – Sliced array with dim removed.

Example

Extract depth at a given temperature and temperature at a given depth:

dep_at_t20 = isoslice(dep, temp, 20, "z")   # depth at temperature=20
temp_at_z15 = isoslice(temp, dep, -15, "z")  # temperature at depth=-15m