Skip to content

Commit

Permalink
BUG: Address grid mapping not being written. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Jan 9, 2024
1 parent 5efd3a9 commit 9598ecf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pygeoutils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,8 @@ def xd_write_crs(ds: XD, crs: CRSTYPE | None = None, grid_mapping_name: str | No
for v in ds:
if "grid_mapping" in ds[v].attrs:
_ = ds[v].attrs.pop("grid_mapping")

if "spatial_ref" in ds and grid_mapping_name != "spatial_ref":
ds = ds.drop_vars("spatial_ref")
ds = ds.rio.write_crs(crs, grid_mapping_name=grid_mapping_name)
ds = ds.rio.write_coordinate_system()
return ds
Expand Down

0 comments on commit 9598ecf

Please sign in to comment.