Skip to content

Commit

Permalink
fix ressample_spatial dims
Browse files Browse the repository at this point in the history
  • Loading branch information
clausmichele committed Feb 28, 2024
1 parent 50786cc commit 9df6f9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_language_version:
python: python3
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ def resample_spatial(
how=projection, resolution=resolution, resampling=method
)

if "longitude" in reprojected.dims and "x" in data.dims:
reprojected = reprojected.rename({"longitude": "x"})
if reprojected.openeo.x_dim != data.openeo.x_dim:
reprojected = reprojected.rename({reprojected.openeo.x_dim: data.openeo.x_dim})

if "latitude" in reprojected.dims and "y" in data.dims:
reprojected = reprojected.rename({"latitude": "y"})
if reprojected.openeo.y_dim != data.openeo.y_dim:
reprojected = reprojected.rename({reprojected.openeo.y_dim: data.openeo.y_dim})

reprojected.attrs["crs"] = data_cp.rio.crs

Expand Down

0 comments on commit 9df6f9c

Please sign in to comment.