xoa.coords.geo_merge#
- xoa.coords.geo_merge(lon, lat, stack_dim='pts')[source]#
Merge lon/lat coordinates into data arrays with coherent dimensions
Four cases are handled:
DataArray, same dims: already a point cloud or an aligned nD array. Dimension and variable names are preserved.
DataArray, different dims: rectangular (
lon(x)+lat(y)) or partially shared grid. Both arrays are broadcast to the union of dimensions with latitude-only dimensions first (y before x).Numpy, same shape: point cloud or nD grid, with auto-generated dimension names (
stack_dim,stack_dim_y/stack_dim_x, …).Numpy 1D, different sizes: rectangular grid converted with
numpy.meshgrid()to shape(ny, nx).
- Parameters:
lon (array_like, xarray.DataArray) – Longitude and latitude arrays, any shape. Names of data arrays are preserved, and others are named
"lon"and"lat".lat (array_like, xarray.DataArray) – Longitude and latitude arrays, any shape. Names of data arrays are preserved, and others are named
"lon"and"lat".stack_dim (str) – Base name used when auto-generating dimension names.
- Returns:
xarray.DataArray – Longitudes with coherent dimensions.
xarray.DataArray – Latitudes with the same dimensions.
See also