uxarray.Grid.cross_section.constant_longitude_interval#
- Grid.cross_section.constant_longitude_interval(lons, return_face_indices=False, inverse_indices=False)#
Extracts a cross-section of the grid by selecting all faces are within a specifed longitude interval.
- Parameters:
lons (Tuple[float, float]) – The longitude interval (min_lon, max_lon) at which to extract the cross-section, in degrees. Values must be between -180.0 and 180.0
return_face_indices (bool, optional) – If True, also returns the indices of the faces that intersect are within a specifed longitude 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 intersect with the specified longitude 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 longitude interval.
Examples
>>> # Extract grid between 0° and 45° longitude >>> cross_section = grid.cross_section.constant_longitude_interval( ... lons=(0.0, 45.0) ... ) >>> # With face indices >>> cross_section, faces = grid.cross_section.constant_longitude_interval( ... lons=(0.0, 45.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.