datacube.utils.geometry.assign_crs¶
- datacube.utils.geometry.assign_crs(xx, crs=None, crs_coord_name='spatial_ref')[source]¶
Assign CRS for a non-georegistered array or dataset.
Returns a new object with CRS information populated.
Can also be called without
crs
argument on data that already has CRS information but not in the format used by datacube, in this case CRS metadata will be restructured into a shape used by datacube. This format allows for better propagation of CRS information through various computations.xx = datacube.utils.geometry.assign_crs(xr.open_rasterio("some-file.tif")) print(xx.geobox) print(xx.astype('float32').geobox)
- Parameters
xx (xarray.DataArray | xarray.Dataset) – Dataset or DataArray
crs (
Union
[str
,CRS
,CRS
,Dict
[str
,Any
],None
]) – CRS to assign, if omitted try to guess from attributescrs_coord_name (
str
) – how to name crs corodinate (defaults tospatial_ref
)
- Return type