uxarray.Grid.cross_section.constant_latitude_interval

uxarray.Grid.cross_section.constant_latitude_interval#

Grid.cross_section.constant_latitude_interval(lats, return_face_indices=False, inverse_indices=False)#

Extracts a cross-section of the grid by selecting all faces that are within a specified latitude interval.

Parameters:
  • lats (Tuple[float, float]) – The latitude interval (min_lat, max_lat) at which to extract the cross-section, in degrees. Values 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 latitude interval.

  • 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 are within a specified latitude interval.

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

Raises:

ValueError – If no faces are found within the specified latitude interval.

Examples

>>> # Extract grid between 30°S and 30°N latitude
>>> cross_section = grid.cross_section.constant_latitude_interval(
...     lats=(-30.0, 30.0)
... )
>>> # With face indices
>>> cross_section, faces = grid.cross_section.constant_latitude_interval(
...     lats=(-30.0, 30.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.