uxarray.Grid.subset.constant_latitude

uxarray.Grid.subset.constant_latitude#

Grid.subset.constant_latitude(lat, return_face_indices=False, inverse_indices=False)#

Extracts a subset of the grid by selecting all faces that intersect with a specified line of constant latitude.

Parameters:
  • lat (float) – The latitude at which to extract the subset, in degrees. Must be between -90.0 and 90.0

  • return_face_indices (bool, optional) – If True, also returns the indices of the faces that intersect with the line of constant latitude.

  • inverse_indices (Union[List[str], Set[str], bool], optional) – Controls storage of original grid indices. Options: - True: Stores original face indices - List/Set of strings: Stores specified index types (valid values: “face”, “edge”, “node”) - False: No index storage (default)

Returns:

  • uxarray.Grid – A subset of the original grid containing only the faces that intersect with the specified latitude.

  • Tuple[uxarray.Grid, numpy.ndarray], optional – If return_face_indices=True, returns a tuple of (grid_subset, face_indices)

Raises:

ValueError – If no intersections are found at the specified latitude.

Examples

>>> # Extract grid at 25° latitude
>>> cross_section = grid.cross_section.constant_latitude(lat=25.0)
>>> # With face indices
>>> cross_section, faces = grid.cross_section.constant_latitude(
...     lat=25.0, return_face_indices=True
... )

Notes

The initial execution time may be significantly longer than subsequent runs due to Numba’s just-in-time compilation. Subsequent calls will be faster due to caching.