geoxarray.coords module
Helper functions for generating coordinate arrays for Xarray objects.
The functions in this module are public, but typically don’t need to be
directly imported by users. It is recommended to use the various coordinate
methods of the geoxarray Xarray accessor (.geo
).
- geoxarray.coords.spatial_coords(data_arr)[source]
Generate 1-dimensional spatial coordinate arrays for a DataArray.
Currently supported cases are:
geotiff read with kerchunk via tifffile
pyresample
AreaDefinition
in.attrs["area"]
- Parameters:
data_arr (
DataArray
) – DataArray object to extract geolocation information from and generate the corresponding coordinate arrays.- Return type:
dict
[str
,Union
[Buffer
,_SupportsArray
[dtype
[Any
]],_NestedSequence
[_SupportsArray
[dtype
[Any
]]],bool
,int
,float
,complex
,str
,bytes
,_NestedSequence
[bool
|int
|float
|complex
|str
|bytes
]]]- Returns:
Dictionary mapping “x” and “y” dimension names to the corresponding 1-dimensional array-like object. Currently only numpy arrays are returned.
- Raises:
ValueError – If the necessary metadata can’t be found in the DataArray