Skip to content

Commit 65606b1

Browse files
committed
Skip decimate for small files
1 parent 7da7598 commit 65606b1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • src/ref_sample_data/data_request

src/ref_sample_data/data_request/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ def decimate_dataset(self, dataset: xr.Dataset) -> xr.Dataset | None:
120120
xr.Dataset
121121
The downscaled dataset
122122
"""
123+
# If less than 10 MB skip decimating
124+
small_file_threshold = 10 * 1024**2
125+
if dataset.nbytes < small_file_threshold:
126+
return dataset
127+
123128
if "time" in dataset.dims and self.time_span is not None:
124129
result = dataset.sel(time=slice(*self.time_span))
125130
if result.time.size == 0:

0 commit comments

Comments
 (0)