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
Return type

Union[Dataset, DataArray]