collocate

Contents

collocate#

collocate(reference: DataArray | Dataset, other: DataArray | Dataset, resampling: Resampling = Resampling.nearest, **kwargs) DataArray | Dataset[source]#

Collocate two georeferenced arrays: forces the other raster to be exactly georeferenced onto the reference raster by reprojection.

Parameters:
  • reference (AnyXrDataStructure) – Reference xarray

  • other (AnyXrDataStructure) – Other xarray

  • resampling (Resampling) – Resampling method

Returns:

Collocated xarray

Return type:

AnyXrDataStructure

Examples

>>> reference_path = "path/to/reference.tif"
>>> other_path = "path/to/other.tif"
>>> col_path = "path/to/collocated.tif"
>>>
>>> # Collocate the other to the reference
>>> col_xds = collocate(read(reference_path), read(other_path), Resampling.bilinear)
>>>
>>> # Write it
>>> write(col_xds, col_path)