Repository navigation
Conversation
Add a generic ZarrCache for resampling look-up tables, enabled with the new 'cache_resampling_luts' config option and stored under 'cache_dir'. The gradient search resampler uses it for area-to-area resampling to cache the target area projection coordinates transformed to the source projection. The cache is namespaced and versioned so that the kd-tree based resamplers can later store their indices in it too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #759 +/- ##
==========================================
+ Coverage 93.90% 94.02% +0.12%
==========================================
Files 89 90 +1
Lines 13924 14205 +281
==========================================
+ Hits 13075 13356 +281
Misses 849 849
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Caching the indices skips the search entirely on a cache hit. The cache key covers both the source and the target area and the block layout, so source areas of different resolution or extent each get their own entry, and the cached indices are identical to uncached ones. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Oh, of course the initial cache run is faster than Timings when actually writing the images to COG.
|
|
I went through the code, and LGTM. I just added optional dependencies for I also ran some more tests with FCI data when saving the images to disk. This time I reduced the main: 87.9 s Also memory usage dropped from 10 GB close to, or just below, 8 GB for every case. With |
|
Couple of additional suggestions Claude gave me yesterday evening but forgot to think about: |



New attempt at speeding up gradient search, now with caching. I asked Claude to start with adding a generic zarr-backed caching and implement caching for target area's projection coordinates for gradient search. That part is in the first commit. Then I asked about other caching possibilities, and we changed the caching so that the actual xy indices are stored. That is in the second commit, and matches how caching for kdtree-based nearest and bilinear resamplers work, so that's consistent. So for every source and target area combination there's a separate cache.
Timing comparisons (seconds):
Memory usage comparisons (RSS, in MB):
Comparison between caching only the target projection coordinates vs. full indices vs.
main:Claude's summary:
Caching off: the branch performs the same as
main. Time is within ±3 % and peak RSS within ±5 % in allsix cases, with differences in both directions.
Warm cache, time: 1.8–3.8× faster end to end.
precompute()for hashing both areas and opening the Zarr store.precompute()stays lazy, with no dask computation.Warm cache, memory:
likely cause is reading and decompressing the float64 indices for each block. This wasn't profiled further.
Cold cache:
main(+0.2 to +1.3 s), because the indices for the whole targetarea are computed and written during
precompute(), before the interpolation starts.mainto +43 %.precompute()peak is 1.4 GB above baseline, for the 36 Mpix target at chunk 4096.each channel resolution pays it once.
Disk: about 14.3–14.7 bytes per target pixel, almost the 16 bytes of the raw float64 x/y index pair.
That's 56 MB, 125 MB and ~490 MB per source resolution for the three targets.
Results: cached results are bit-identical to uncached ones, which the tests check.
Indices vs coordinates cache:
main.extent now needs its own entry and its own cold run.
Closes #xxxx
Tests added
Tests passed
Fully documented