From a5192ede0635bf8b6e97e8502a61724c95330306 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Sat, 28 Feb 2026 23:50:00 +0100 Subject: [PATCH] Fix bilinear cache type decoding --- pyresample/bilinear/xarr.py | 9 ++++----- pyresample/test/test_bilinear.py | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyresample/bilinear/xarr.py b/pyresample/bilinear/xarr.py index e53fed475..85cc82238 100644 --- a/pyresample/bilinear/xarr.py +++ b/pyresample/bilinear/xarr.py @@ -28,10 +28,9 @@ import dask.array as da import numpy as np -import zarr from dask import delayed from pyproj import Proj -from xarray import DataArray, Dataset +from xarray import DataArray, Dataset, open_zarr from pyresample import CHUNK_SIZE from pyresample.bilinear._base import ( @@ -210,11 +209,11 @@ def save_resampling_info(self, filename): def load_resampling_info(self, filename): """Load bilinear resampling look-up tables and initialize the resampler.""" try: - fid = zarr.open(filename, mode='r') + fid = open_zarr(filename, chunks="auto") for val in BIL_COORDINATES: - cache = da.array(fid[val]) + cache = fid[val].data setattr(self, val, cache) - except ValueError as err: + except (FileNotFoundError, KeyError, OSError, ValueError) as err: raise IOError("Invalid information loaded from resampling cache") from err diff --git a/pyresample/test/test_bilinear.py b/pyresample/test/test_bilinear.py index f4711ef1b..69308c474 100644 --- a/pyresample/test/test_bilinear.py +++ b/pyresample/test/test_bilinear.py @@ -1206,6 +1206,7 @@ def test_save_and_load_bil_info(self): new_resampler = XArrayBilinearResampler(self.source_def, self.target_def, self.radius) new_resampler.load_resampling_info(filename) + self.assertEqual(new_resampler.mask_slices.dtype, bool) for attr in CACHE_INDICES: orig = getattr(resampler, attr)