uxarray.UxDataArray.cross_section#
- UxDataArray.cross_section()#
Extracts a cross-section sampled along an arbitrary great-circle arc (GCA) or line of constant latitude/longitude.
Exactly one mode must be specified:
Great‐circle: supply both start and end (lon, lat) tuples, samples a geodesic arc.
Constant latitude: supply lat alone (float), returns points along that latitude.
Constant longitude: supply lon alone (float), returns points along that longitude.
- Parameters:
start (tuple[float, float], optional) – (lon, lat) of the geodesic start point.
end (tuple[float, float], optional) – (lon, lat) of the geodesic end point.
lat (float, optional) – Latitude for a constant‐latitude slice.
lon (float, optional) – Longitude for a constant‐longitude slice.
steps (int, default 100) – Number of sample points (including endpoints).
- Returns:
A DataArray with a new “steps” dimension, plus “lat” and “lon” coordinate variables giving the sampling positions.
- Return type:
xr.DataArray
Examples
Cross-section between two points (lon, lat)
>>> uxda.cross_section(start=(-45, -45), end=(45, 45))
Constant latitude cross-section
>>> uxda.cross_section(lat=45)
Constant longitude cross-section
>>> uxda.cross_section(lon=0)
Constant longitude cross-section with custom number of steps
>>> uxda.cross_section(lon=0, steps=200)