Skip to content

Commit

Permalink
no grid_mapping in-place deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Jan 14, 2025
1 parent c19319d commit 069c804
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion xcube/core/resampling/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,12 @@ def resample_in_space(
source_ds = source_ds.drop_vars("crs")

Check warning on line 213 in xcube/core/resampling/spatial.py

View check run for this annotation

Codecov / codecov/patch

xcube/core/resampling/spatial.py#L213

Added line #L213 was not covered by tests
if "spatial_ref" in source_ds:
source_ds = source_ds.drop_vars("spatial_ref")
source_ds = source_ds.copy()
for var in source_ds.data_vars:
if "grid_mapping" in source_ds[var].attrs:
del source_ds[var].attrs["grid_mapping"]
attrs = source_ds[var].attrs
del attrs["grid_mapping"]
source_ds[var] = source_ds[var].assign_attrs(attrs)
transformed_x, transformed_y = transformed_source_gm.xy_coords
attrs = dict(grid_mapping="spatial_ref")
transformed_x.attrs = attrs
Expand Down

0 comments on commit 069c804

Please sign in to comment.