Commit abc8d96
committed
Prevent OOM on large datasets in reproject and merge (#1045)
Three safeguards for datasets that exceed available RAM:
1. Auto-chunk large non-dask inputs (reproject):
If the source array exceeds 512MB, automatically wrap it in
dask.array with the configured chunk_size (default 512x512).
This routes it through the chunked dask path instead of the
in-memory path that would call .values and OOM.
2. Auto-promote merge to dask path:
If the combined output size (output_shape * n_tiles * 8 bytes)
exceeds 512MB, use the dask merge path even if no input is
dask. This prevents _merge_inmemory from calling .values on
each tile.
3. Cap source window size in chunk workers:
If a single output chunk maps to a source window larger than
64 Mpixels (~512MB for float64), return nodata instead of
materializing the window. This prevents extreme projections
(e.g. polar stereographic edge pixels mapping to the entire
source hemisphere) from OOMing individual chunk workers.
A 30TB dataset with 16GB RAM would now:
- Auto-chunk into 512x512 tiles
- Process each tile independently (~2MB working memory per tile)
- Never materialize more than 512MB in a single operation1 parent 4cae5fc commit abc8d96
1 file changed
+35
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
| |||
558 | 565 | | |
559 | 566 | | |
560 | 567 | | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
561 | 588 | | |
562 | 589 | | |
563 | 590 | | |
| |||
1082 | 1109 | | |
1083 | 1110 | | |
1084 | 1111 | | |
1085 | | - | |
| 1112 | + | |
1086 | 1113 | | |
1087 | 1114 | | |
1088 | 1115 | | |
1089 | 1116 | | |
1090 | 1117 | | |
1091 | 1118 | | |
1092 | 1119 | | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
1093 | 1127 | | |
1094 | 1128 | | |
1095 | 1129 | | |
| |||
0 commit comments