uxarray.Grid.cross_section.constant_longitude#
- Grid.cross_section.constant_longitude(lon, return_face_indices=False, inverse_indices=False)#
Extracts a cross-section of the grid by selecting all faces that intersect with a specified line of constant longitude.
- Parameters:
lon (float) – The longitude at which to extract the cross-section, in degrees. Must be between -180.0 and 180.0
return_face_indices (bool, optional) – If True, also returns the indices of the faces that intersect with the line of constant longitude.
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.
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 longitude.
Examples
>>> # Extract grid at 0° longitude (Prime Meridian) >>> cross_section = grid.cross_section.constant_longitude(lon=0.0) >>> # With face indices >>> cross_section, faces = grid.cross_section.constant_longitude( ... lon=0.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.