A state or a country at 30 m is billions of pixels, far more than fits in memory, and its result has millions of rows. This page explains how the library analyzes such regions exactly (the answer is the same as if the whole raster had been analyzed at once), what it costs, and how to run one.
h3lowpoints build --bbox -106.65 25.84 -93.51 36.50 --out texas --min-depth 0.5 \
--cache-dir tiles --format parquet
or in Python, for any raster (a GeoTIFF, or a VRT of many files):
from h3lowpoints import analyze_tiled
res = analyze_tiled("big.vrt", tile=4096, min_depth=0.5, out_dir="texas", format="parquet")
res.meta["n_depressions"], res.meta["output"]["n_cells"]
The tables go straight to the output folder; read_result("texas") or the files themselves are
used afterwards (see Outputs). Leave out --cache-dir to read the tiles over the
internet instead of storing them: slower, but it needs almost no disk (see
Streaming or caching the tiles).
Most raster analyses can cut the data into tiles and process each on its own. Filling cannot: whether a pit holds water depends on the lowest way out, which can lie hundreds of kilometres away. A tile seen alone treats its own border as an outlet, so every depression that touches a tile border would drain away, and a depression spanning several tiles would be split.
The method follows Barnes, Callaghan and Wheeler (2016), “Parallel priority-flood depression filling for trillion cell digital elevation models”:
Why the border summaries suffice is proven in Definition. The test suite compares tiled and whole runs depression by depression and cell by cell on many kinds of terrain and tile sizes, and on real terrain in five countries; they agree exactly.
What has to be held at once:
| Held | Size |
|---|---|
| One tile being processed | about 30 to 40 bytes per pixel: 0.6 GB for a 4096 × 4096 tile |
| The border graph | a few tens of bytes per tile-border pixel; grows with the region (see below) |
| One summary row per depression piece | grows with the number of depressions |
| One partition of cells at a time | bounded (see below) |
| GDAL’s read cache | capped at 256 MB (GDAL’s default is 5% of the machine’s memory) |
What is not held:
min_depth once joined) are removed,
the cells are summed, counted and measured for coverage, and appended to the output file. The
depression table is written in pieces of 500,000 rows. The spill folder is removed afterwards,
also when the run fails.Without out_dir, the same partitions are kept in memory and the tables are returned; this is
the right choice for anything up to a few hundred million pixels.
The tile size never changes the result. Large tiles need more memory per tile; small tiles make the border graph larger (it has a node per tile-border pixel) and add per-tile overhead. Measured on 38.9 million pixels of real terrain around Austin:
| mode | time | extra memory at peak |
|---|---|---|
analyze (whole raster) |
28 to 30 s | 1.4 to 1.5 GB |
analyze_tiled, 2048-pixel tiles |
34 s | 0.50 GB |
analyze_tiled, 1024-pixel tiles |
30 s | 0.31 GB |
analyze_tiled, 512-pixel tiles |
29 s | 0.43 GB |
For regions, 4096 (the default) is a good balance: about 0.6 GB per tile, and a border graph of about one node per 1,000 pixels.
USGS 3DEP 30 m over the box −106.65, 25.84, −93.51, 36.50 (Texas and its surroundings, including
parts of Mexico and the Gulf): 155 tiles, 47,304 × 38,376 = 1.82 billion pixels, analyzed at
H3 resolution 10 with min_depth 0.5 m, tiles of 4096, on a laptop (4 cores, 8 threads, 25.5 GB
memory). The analysis itself runs on one core.
| Depressions | 1,745,430 |
| H3 cells (resolution 10) | 7,906,030 |
Download of the tiles (6.0 GB, once, into --cache-dir) |
10 to 11 minutes |
| Analysis | 25 minutes |
| Verification of the saved result (in pieces) | 31 seconds, no problems |
| Extra memory at peak, analysis | 2.1 GB |
| Extra memory at peak, verification | 1.7 GB (0.6 GB of data; the rest is the Parquet reader’s reusable buffers) |
| Output, Parquet | 56 MB depressions + 273 MB cells |
| Output, CSV (same content) | 1.1 GB |
How the memory came down over the course of development, for this same run with identical output:
| Version | Extra memory at peak |
|---|---|
| First tiled version (tables assembled with pandas in memory) | 11.0 GB |
| Per-tile summaries as arrays, chunked coverage, capped GDAL cache | 3.6 GB |
Per-cell sums spilled to disk, tables written as produced (out_dir) |
2.1 GB |
About 0.9 GB of the 2.1 GB does not grow with the region (one tile and the GDAL cache); the rest is the border graph and one summary row per depression piece.
Measured on 19 October 2026: USGS 3DEP 30 m over the box −124.85, 24.4, −66.9, 49.4 (the lower
48 states, with the coastal waters and the parts of Canada and Mexico that 3DEP covers), H3
resolution 10, min_depth 0.5 m, tiles of 4096, tiles streamed (none stored), on the same
laptop, run in four parts with --hours.
| Raster | 208,620 × 90,000 = 18.8 billion pixel positions, 1,122 tiles (many partly or wholly sea) |
| Depressions | 12,304,679 (240 touching the edge of the data) |
| H3 cells (resolution 10) | 82,027,455 |
| Border graph | 14.3 million tile-border pixels, 69.1 million crossings |
| Time, in four parts | 7.3 hours (2.0 + 2.0 + 2.0 + 1.2) |
| Extra memory at peak | 13.0 GB, for a few minutes while the border levels are solved; 12.4 GB while the tables are assembled; about 2 GB the rest of the time |
| Disk at peak | 12.5 GB (saved tiles and spill files, during the final step) |
| Disk afterwards (Parquet) | 3.1 GB: 0.41 GB depressions + 2.69 GB cells |
| Internet traffic | 100.5 GB |
| Verification | every invariant holds; 3 random windows re-run whole and tiled agree exactly |
Compared with the estimate made from Texas beforehand: the time (7 to 8 hours estimated) and the traffic (85 to 100 GB) were as expected; memory (8 to 10 GB estimated) and output size (2 GB) were higher, because the country has more depressions and cells per pixel than Texas.
Memory peaks twice. The border solve needs every tile’s border summary at once (here 14.3 million border pixels); its result is saved, so a run resumed after it does not repeat it. The final assembly holds one summary row per depression piece and joins pieces across tile borders. Both grow with the region, so a computer with 16 GB of memory is the practical minimum for the lower 48 at resolution 10. A hierarchical version of the method would bound them (Roadmap).
This run, clipped to the lower 48 states, was published as version 0.1 of the open dataset: doi.org/10.5281/zenodo.23552773. Version 0.2 replaces it (below).
Measured on 20 and 21 October 2026: the same box and settings with --water-mask, after the
improvements that came out of the first run (one outlet node per tile, validity records for
coverage, a tile-by-tile mask, retried requests). Run in four parts.
| Without the mask (19 Oct) | With the mask (20 to 21 Oct) | |
|---|---|---|
| Depressions | 12,304,679 | 12,124,617 |
| H3 cells (resolution 10) | 82,027,455 | 39,124,039 |
| Depressed area / volume | 831,258 km² / 22,404 km³ | 222,662 km² / 838 km³ |
| Largest depression | Lake Superior, 82,407 km² | a desert basin on the Nevada–Utah border, 868 km² |
| Border graph | 14.3 million nodes, 69.1 million crossings | 12.7 million nodes, 61.9 million crossings |
| Time | 7.3 hours | 8.9 hours, of which 1.4 for the water mask |
| Extra memory at peak | 13.0 GB | 11.9 GB (border solve); 7.1 GB in the final step |
| Internet traffic | 100.5 GB | about 113 GB |
| Results (Parquet) | 3.1 GB | 1.9 GB |
| Verification | all invariants, 3 spot checks | all invariants, 3 spot checks |
Masking water kept 98.5% of the depressions, with the same typical size (median about 1 m deep and 2,700 m²), and removed what was open water counted as terrain: the Great Lakes, reservoirs and lakes held by their outlets, which made up most of the depressed area and volume and over half of the cells. The largest depressions are now dry closed basins of the desert West. A closed basin whose lowest part holds a permanent lake (the Great Salt Lake basin, for instance) now drains into that lake instead of counting as one depression: the right reading when the question is where water ponds on land.
Measured on 25 October 2026: the same box with --water-mask --catchments --details --workers 4
(and the open sea in the water mask, Data sources).
Run in seven parts; before the last one the run was stopped on purpose, at 1,109 of 1,122 tiles of
pass 2, to free disk space before the final step, then resumed with the same command.
| Depressions | 12,122,323 (182 touching the edge of the data) |
| H3 cells (resolution 10) | 39,124,305 |
| Border graph | 12.4 million nodes, 60.4 million crossings |
| Time | 12.2 hours: water mask 1.5, pass 1 3.4, border solve a few minutes, pass 2 5.9, final step 1.4 |
| Extra memory at peak | 11.7 GB (border solve); 8.3 GB while the tables are assembled; 10.3 GB for the verification at the end |
| Disk at peak | 26.2 GB (saved tiles, spill files and the tables being written, in the final step) |
| Results (Parquet) | 9.9 GB: 5.15 GB catchments, 1.81 GB depression × cell, 1.46 GB depressions, 1.42 GB cells |
| Internet traffic | about 112 GB |
| Verification | all invariants, including those of catchments and details; 3 spot checks |
The catchments, spill links, levels, shape and fill curves add about 3.3 hours to the run and five times the output. The depressions are those of the water-masked run above, apart from two causes. USGS updated nine 3DEP tiles in Washington on 21 October 2026, between the two runs; and the sums of a depression’s tile pieces are added in another order, which changes the last digits (at most 1 part in 10¹²) of a few hundred depressions’ area or volume. Masking the open sea changed routing, not depressions. Clipped to the lower 48 states, this is version 0.2 of the national dataset: doi.org/10.5281/zenodo.23669497.
A national run takes many hours. Every tile’s result is saved to _work/ in the output folder as
soon as it is finished, so the run never has to be done in one go:
--hours 2 (or hours=2 in Python) stops cleanly at the end of the
first tile after two hours and exits with code 3, saying how far it got. Run the same command
again for the next part, whenever convenient, until it finishes.catchments=True and details=True, test runs on three 1° boxes at 30 m (Houston,
North Dakota prairie potholes, the Central Valley of California) needed 1.3 to 2.6 bytes of
disk per valid pixel at peak, half what they needed uncompressed, and took 1.5 to 1.9 times as
long as without those options.verify and
clip read the depression table in pieces. Rehearsed on the saved tiles of a national run with
catchments and details (12.3 million depression pieces, 52 million flat pixels across tile
borders): the final assembly took 61 minutes with a peak of 7.2 GB; verify 10 minutes, 8.8 GB;
clipping to the lower 48 states 7 minutes, 6.3 GB. The border solve (about 12 GB for the lower 48)
stays the run’s highest point.Why not simply cut the country into regions analyzed separately? Each region’s edge would act as an outlet, draining water across lines that do not exist, and depressions crossing those lines would be cut in two. Saving tiles keeps the exact method and still allows the work to be split.
Run regions with --water-mask when lakes and reservoirs should count as open water (see
Data sources). The mask is built once before the
analysis, tile by tile, as water.vrt and one small file per tile holding water in
water_tiles/; like the analysis it continues where it stopped and counts against --hours. For
the lower 48 it is estimated at about 2 hours (52 million pixels of Wisconsin took 19 s; the time
goes into decompressing WorldCover). Every pixel next to water is an outlet, but outlets inside a
tile share one node of the border graph (Definition), so the graph does
not grow with shorelines: on a box of Great Salt Lake it has 24,827 nodes with the mask against
25,194 without. Cells along shores are only partly covered, so their coverage is measured
exactly, pixel by pixel. Pass 1 records each tile’s invalid pixels (compressed, about
a bit per pixel before compression), and coverage reads those records rather than the elevation
data again, which for streamed tiles would mean the internet once per shoreline cell. On the
Lake Erie box the masked analysis takes 10 s (15 s without the mask, since there is less land);
reading the elevation data per cell had taken 72 s, and on the Great Salt Lake box 75 s against
25 s now, with identical results.
A tiled run reads every pixel twice (once per pass). build can get the 3DEP tiles in two ways,
with exactly the same result:
--cache-dir): each part of a tile is read over the internet when it is
needed, and nothing is stored. Needs almost no disk, but every read waits on the network and
each tile is fetched twice.--cache-dir DIR): each tile is downloaded once (about 40 MB per 1° tile at 30 m)
and read from disk. Faster, but needs room for all the tiles; delete the folder afterwards.Measured on one box of 2° × 2° (−99, 30, −97, 32: 4 tiles, 51.8 million pixels, 54,619 depressions) on the same laptop and home internet connection, one run each way:
| Streamed | Cached | |
|---|---|---|
| Getting the tiles | 1 s (only checks they exist) | 22 s (221 MB downloaded) |
| Analysis | 114 s | 47 s |
| Total | 114 s | 69 s |
| Internet traffic | 398 MB | 221 MB |
| Disk used | 8 MB (results) | 219 MB tiles + 8 MB results |
| Extra memory at peak | 1.2 GB | 1.1 GB |
| Result | identical | identical |
So streaming took about 1.65 times as long in total and moved about 1.8 times as much data, in exchange for storing nothing. The ratio depends on the connection; measure a small box first on yours. If a run is interrupted, cached tiles already downloaded are kept (a half-downloaded tile is never used) and the next run fetches only the missing ones; the analysis itself starts again from the beginning. A streamed read that fails is retried up to ten times with a delay that at least doubles (at least 17 minutes in all), after which the run stops with an error rather than produce a wrong result.
min_depth for the data. On 30 m data, depressions under about 0.5 m are within the
vertical error and also multiply the output size.build runs the invariants on completion and writes verify.json; add
--spot-check N to re-run N random windows whole and tiled.