Skip to content

Commit

Permalink
little error resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Jan 17, 2025
1 parent f1654b7 commit ee81a04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xcube/core/resampling/spatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ def resample_in_space(
# transform the source_gm so its CRS matches the target CRS:
transformed_source_gm = source_gm.transform(target_gm.crs, xy_res=target_gm.xy_res)
source_ds = source_ds.drop_vars(source_gm.xy_dim_names)
list_grid_mapping = []
for var in source_ds.data_vars:
if "grid_mapping" in source_ds[var].attrs:
attrs = source_ds[var].attrs
source_ds = source_ds.drop_vars(attrs["grid_mapping"])
list_grid_mapping.append(attrs["grid_mapping"])
del attrs["grid_mapping"]
source_ds[var] = source_ds[var].assign_attrs(attrs)
source_ds = source_ds.drop_vars(list_grid_mapping)
if "crs" in source_ds:
source_ds = source_ds.drop_vars("crs")
if "spatial_ref" in source_ds:
Expand Down

0 comments on commit ee81a04

Please sign in to comment.