collocate#

collocate(master_xds: Union[Dataset, DataArray], slave_xds: Union[Dataset, DataArray], resampling: Resampling = Resampling.nearest) Union[Dataset, DataArray][source]#

Collocate two georeferenced arrays: forces the slave raster to be exactly georeferenced onto the master raster by reprojection.

>>> master_path = "path/to/master.tif"
>>> slave_path = "path/to/slave.tif"
>>> col_path = "path/to/collocated.tif"

>>> # Collocate the slave to the master
>>> col_xds = collocate(read(master_path), read(slave_path), Resampling.bilinear)

>>> # Write it
>>> write(col_xds, col_path)
Parameters:
  • master_xds (XDS_TYPE) – Master xarray

  • slave_xds (XDS_TYPE) – Slave xarray

  • resampling (Resampling) – Resampling method

Returns:

Collocated xarray

Return type:

XDS_TYPE