From 3621b20a37a6fe03464dfbd52ea17f9e4bb981bf Mon Sep 17 00:00:00 2001 From: Pascal Bourgault Date: Thu, 31 Oct 2024 11:23:21 -0400 Subject: [PATCH] Fix deprecation error in xarray 2024.10 --- .github/workflows/ci.yaml | 2 +- CHANGES.rst | 1 + xesmf/frontend.py | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6e75790..acbcf8c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,7 +31,7 @@ jobs: - python-version: "3.11" esmf-version: 8.6 - python-version: "3.12" - esmf-version: 8.6 + esmf-version: 8.7 steps: - name: Cancel previous runs uses: styfle/cancel-workflow-action@0.12.1 diff --git a/CHANGES.rst b/CHANGES.rst index d0cfa8a..adfcc0d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ What's new 0.8.8 (unreleased) ------------------ * Fix ESMpy memory issues by explictly freeing the Grid memory upon garbage collection of ``Regridder`` objects. By `Pascal Bourgault `_. +* Address deprecation for xarray 2024.10 in the parallel weight generation. By `Pascal Bourgault `_. 0.8.7 (2024-07-16) ------------------ diff --git a/xesmf/frontend.py b/xesmf/frontend.py index 234af95..b6e88ca 100644 --- a/xesmf/frontend.py +++ b/xesmf/frontend.py @@ -1049,9 +1049,9 @@ def _init_para_regrid(self, ds_in, ds_out, kwargs): {self.out_horiz_dims[0]: 'y_out', self.out_horiz_dims[1]: 'x_out'} ) - out_chunks = [ds_out.chunks.get(k) for k in ['y_out', 'x_out']] - in_chunks = [ds_in.chunks.get(k) for k in ['y_in', 'x_in']] - chunks = out_chunks + in_chunks + out_chunks = {k: ds_out.chunks.get(k) for k in ['y_out', 'x_out']} + in_chunks = {k: ds_in.chunks.get(k) for k in ['y_in', 'x_in']} + chunks = out_chunks | in_chunks # Rename coords to avoid issues in xr.map_blocks for coord in list(self.out_coords.keys()):