xarray.Dataset.proj.assign_crs#
- Dataset.proj.assign_crs(spatial_ref_crs=None, allow_override=False, **spatial_ref_crs_kwargs)#
Assign one or more spatial reference coordinate variables, each with a given coordinate reference system (CRS).
Doesn’t trigger any coordinate transformation or data resampling.
- Parameters:
spatial_ref_crs (dict-like or
None, optional) – A dict where the keys are the names of the (scalar) coordinate variables and values target CRS in any format accepted bypyproj.CRS.from_user_input()such as an authority string (e.g."EPSG:4326"), EPSG code (e.g.4326) or a WKT string. If the coordinate(s) doesn’t exist it will be created.allow_override (
bool, defaultFalse) – Allow to replace the index if the coordinates already have an index.**spatial_ref_crs_kwargs (optional) – The keyword arguments form of
spatial_ref_crs. One ofspatial_ref_crsorspatial_ref_crs_kwargsmust be provided.
- Returns:
DatasetorDataArray– A new Dataset or DataArray object with new or updated spatial reference coordinate variables.