Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pyresample/bilinear/xarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: caches written before this change (raw uint8 bools via zarr.open) will still come back as uint8 under open_zarr, since no dtype marker was persisted. Caches regenerate on the next save, so it's benign — a changelog note (or cache version bump) would prevent future confusion.

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


Expand Down
1 change: 1 addition & 0 deletions pyresample/test/test_bilinear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading