xarray.Dataset.proj.map_crs

xarray.Dataset.proj.map_crs#

Dataset.proj.map_crs(spatial_ref_coords=None, allow_override=False, transform=False, **spatial_ref_coords_kwargs)#

Map spatial reference coordinate(s) to other indexed coordinates.

This has an effect only if the latter coordinates have a CRS-aware index. The index must then support setting the CRS via the proj index interface.

Parameters:
  • spatial_ref_coords (dict, optional) – A dict where the keys are the names of (scalar) spatial reference coordinates and values are the names of other coordinates with an index.

  • allow_override (bool, optional) – If True, replace the CRS of the target index(es) even if they already have a CRS defined (default: False).

  • transform (bool, optional) – If True (default: False), transform coordinate data to conform to the new CRS.

  • **spatial_ref_coords_kwargs (optional) – The keyword arguments form of spatial_ref_coords. One of spatial_ref_coords or spatial_ref_coords_kwargs must be provided.

Returns:

Dataset or DataArray – A new Dataset or DatArray object with updated CRS-aware indexes (and possibly updated coordinate data).