Skip to content

Commit eea9c61

Browse files
perf: speed up indices-based retrieval
1 parent e3c4c35 commit eea9c61

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/earthkit/data/sources/gribjump.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ def from_mars_requests(
242242
ranges = mask_to_ranges(mask)
243243
mask = None
244244

245+
if indices is not None:
246+
# We do the same small optimization for indices. Optimally, we
247+
# would do similar optimizations in pygribjump and remove this.
248+
ranges = [(i, i + 1) for i in indices]
249+
indices = None
250+
245251
extraction_requests = [build_extraction_request(req, ranges, mask, indices) for req in mars_requests]
246252
return cls(extraction_requests)
247253

0 commit comments

Comments
 (0)