Skip to content

Commit

Permalink
Update AHI tests to use new resolution-based chunking normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Oct 6, 2023
1 parent 9169abe commit ec20ba9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions satpy/readers/ahi_hsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
np2str,
unzip_file,
)
from satpy.utils import chunks_by_resolution
from satpy.utils import normalize_low_res_chunks

AHI_CHANNEL_NAMES = ("1", "2", "3", "4", "5",
"6", "7", "8", "9", "10",
Expand Down Expand Up @@ -619,11 +619,13 @@ def _read_data(self, fp_, header, resolution):
"""Read data block."""
nlines = int(header["block2"]['number_of_lines'][0])
ncols = int(header["block2"]['number_of_columns'][0])
chunks = chunks_by_resolution(
chunks = normalize_low_res_chunks(
("auto", "auto"),
(nlines, ncols),
# 1100 minimum chunk size for 500m, 550 for 1km, 225 for 2km
(1100, 1100),
(int(resolution / 500), int(resolution / 500)),
np.float32,
550,
int(resolution / 500),
)
return da.from_array(np.memmap(self.filename, offset=fp_.tell(),
dtype='<u2', shape=(nlines, ncols), mode='r'),
Expand Down
2 changes: 1 addition & 1 deletion satpy/tests/reader_tests/test_ahi_hsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test_read_band_from_actual_file(self, hsd_file_jp01):
fh = AHIHSDFileHandler(hsd_file_jp01, filename_info, filetype_info)
key = {"name": "B01", "calibration": "counts", "resolution": 1000}
import dask
with dask.config.set({"array.chunk-size": "16MiB"}):
with dask.config.set({"array.chunk-size": "32MiB"}):
data = fh.read_band(
key,
{
Expand Down

0 comments on commit ec20ba9

Please sign in to comment.