tams.contour

Contents

tams.contour#

tams.contour(x, value, *, unstructured=None, triangulation=None, closed_only=True, tolerance=1e-12)#

Contour x at value, producing a dataframe of contour lines.

Parameters:
  • x (xarray.DataArray) – Data to be contoured. Needs to have 'lat' and 'lon' coordinates. The array should be 2-D if structured, 1-D if unstructured.

  • value (float) – Find contours where x has this value.

  • unstructured (bool | None) – Whether the grid of x is unstructured (e.g. MPAS native output). Default: assume unstructured if x is 1-D.

  • triangulation (Triangulation, optional) – A pre-computed Triangulation for x with unstructured grid.

  • closed_only (bool) – Only return closed contours.

  • tolerance (float) – Tolerance for snapping the start and end points of a contour together and for removing repeated points.

Returns:

cs (geopandas.GeoDataFrame) – GeoDataframe of analyzed contours. Closed contours as LinearRing, open contours as LineString.

Columns:

  • contour – geometry, the contours

  • closed – bool, whether the contour is closed

  • encloses_higher – nullable bool, if closed, whether the contour encloses a region with values higher than value. If not closed, this is null.

Raises:

ValueError – If all values in x are null. Or if x has an unexpected number of dimensions.

Return type:

geopandas.GeoDataFrame