GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||
GeezerVison is showing fullhydro.org — FlowTopo — FullHydro Get itPython 3.10 or newer. The structures and the serial kernels run in pure Python without numba; the threaded kernels need numba.
Quick start
Three of the kernels also run on threads, a layer at a time (needs numba); Strahler stream order runs serially only:
For a FullTopo v1.1 region, use the following command to compute each pixel’s upstream interval from the region’s
Example data
Any D8 GeoTIFF in the same convention works, north up, in longitude and latitude or in a projection whose unit is the metre: the CRS decides whether the area and distance kernels read the grid as degrees or as metres, and a rotated grid or a projection in another unit is refused. Direction codes are powers of two clockwise from east. Codes 0 and 255 mark terminal pixels; 247 is always nodata, and a nodata value declared in the file is excluded as well. Process one region or basin at a time: indices are int32, so a raster must stay under 2.1 billion pixels, nodata included, as the regions of MERIT-FullBasin do. What you getEight structures, grouped by the question each one answers, and three ways to pass a value from a pixel to its receiver. All are built from the D8 grid. Every clip runs on the same example basin; it plays while it is on screen, and opens full size on a click. One core: in what order?Three serial orderings. A kernel is computed in one pass over any of them. They differ in memory access, and so in speed. ordering="topo"a pixel is appended once all its donors are doneordering="bfs"pixels in order of hop count from the pitordering="dfs"one tributary subtree at a time; best cache localityMany threads: which pixels together?Three parallel layerings. Layers run in order; the pixels of one layer run at the same time. layering="asap"every pixel in the earliest layer its donors allowlayering="cfds"as-soon-as-possible, plus: no two pixels in a layer share a receiverlayering="alap"every pixel as late as the longest flow path allows; the most evenly filled layers in practiceSeveral processors: which pixels where?Two spatial partitions, one subregion per processor. Both cut along the drainage hierarchy, so no value crosses a boundary while a kernel runs.
Basin-level
level="basin"Whole basins go to subregions; one dominant basin leaves the partition unbalanced. Subbasin-level
level="subbasin"The basins that keep the subregions from balancing, usually the dominant one, are opened along their mainstems; their tributary subtrees balance the load, and the held-back mainstem section runs as its own stage. At a confluence: how does a value reach the receiver?Three propagation manners. The structure decides when a pixel runs; the manner decides who writes the result. manner="pull"each receiver reads its donors and writes only its own value; needs the donor tablemanner="atomic_push"donors write through atomics; correct, but floating-point sums are not bit-reproduciblemanner="push"donors write directly; deterministic, no locks; safe only under cfdsThree things to know
Four kernels come with the package: upstream drainage area, flow length downstream ( Write conflicts and cache locality on the example basinA push is only safe if no two pixels in a layer write to the same receiver. Conflicting writes inside a layer, example basin (93,432 pixels):
The count is a property of the layering and can be checked before running. A test run cannot replace that check, because a race does not show up every time. Under the conflict-free downstream layering, no two pixels in a layer share a receiver, so the push adds in the same order every time and gives bit-identical results at any thread count. Strahler stream order cannot be done with one atomic operation, because its confluence rule is a comparison and a count, not an addition; the only parallel push for it is under the conflict-free layering. When The three serial orderings differ in memory access. Simulated L1 miss rate on the example basin: depth-first 10.5%, breadth-first 21.8%, topological sort 37.1% ( Which structure to useFrom the paper’s benchmark of the C implementation on the 90 m network (22.2 billion pixels, 65 continental regions):
The Python package is meant for far smaller grids, and there the ranking is not the same: on 16 million pixels, push under Global productsUsing the C implementation over the 90 m MERIT Hydro network, the same methods produced two Zenodo records of per-region GeoTIFFs. Both cover the 65 continental regions of FullBasin v1.0; the 29 island groups and the two regions that straddle the antimeridian are not included.
Version 1.1 of the three datasets, computed on the 90 regions of FullDivide v1.1 (global, the island groups and the two regions across 180° included), is on Zenodo too: FullTopo v1.1 10.5281/zenodo.23697404, FullAttr v1.1 10.5281/zenodo.23730210 and FullBasin v1.1 (FullDivide and FullMorph) 10.5281/zenodo.22895352. On this site the v1.1 files can be downloaded one by one, in Downloads. Four maps over the 65 regionsSerial orderings: the sequence index of each ordering, globally and in the example basin
(a) topological sort from the sources, (b) breadth-first search from the pit, (c) depth-first search from the pit. The topological sort rises smoothly from headwaters to outlets, breadth-first forms bands of equal hop count from the outlet, depth-first breaks the basin into one compact block per tributary. Global maps share one scale from 0 to the total pixel count; each example-basin map uses its own scale; the red triangle is the outlet. All three are stored upstream to downstream; breadth-first and depth-first search from the pit are built from the outlet but re-stored upstream to downstream, so the colour shows each order’s structure, not where its construction began. Parallel layerings: the layer index of each layering; only as-late-as-possible fills its layers evenly
(a) as-soon-as-possible, (b) conflict-free downstream, (c) as-late-as-possible. Under (a) and (b) most pixels sit in the first few layers and only the main rivers reach high indices, so the global scale is cut at 3,000; (c) spreads the pixels over all layers and uses the full range, tens of thousands in the largest basins. The example basin has 949 layers under all three. All three are stored upstream to downstream. Spatial partitions: every region split four ways, Region 43 before and after the mainstem cut
(a, c) all 65 regions; (b, d) Region 43, subregions 4301 to 4304. Top row basin-level: the dominant basin of Region 43 fills one subregion on its own. Bottom row subbasin-level: the basin is cut along its mainstem (purple) and the four subregions come out balanced. The same four colours are used in every region. Kernel products: the four FullAttr v1.0 variables mapped
(a) flow length downstream, km; (b) flow length upstream, km; (c) Strahler stream order on channels draining at least 10 km²; (d) upstream drainage area, km², colour scale cut at 100 km². The red box is the example basin. (d) is released for Region 43 only, since MERIT Hydro distributes it globally. Using the released structuresThe structures index into the MERIT Hydro flow-direction grid, which is not redistributed: get it from the MERIT Hydro page under its own terms. The MERIT Hydro tiles a region needs, and its row and column offsets, are listed in the table of the 96 regions of version 1.0, those of the version 1.0 records on Zenodo (CSV); the 90 regions of FullDivide v1.1, those of the version 1.1 records, are in rat_global_90m_with_tiles. Region boxes sit on whole degrees and one degree is 1,200 pixels, so a region is cut from the global rasters by integer arithmetic, with no resampling. You do not need a whole region. Keep any subset of pixels: the released sequence restricted to them is still a topological sort, and a restricted layering still has independent layers, conflict-free rule included, because removing pixels cannot put a pixel before something it depends on, nor make two remaining pixels depend on each other. A receiver outside the clip becomes an outlet when the clip is loaded. Only the kernel values change: upstream drainage area on a clip counts only the area inside the clip. Use whole basins when the values must match the global ones, or take them from MERIT-DrainAttr. The released 90 m structures were computed with the same methods by a program written for the 90 m grid. On the example basin the two agree, the accumulated area to within floating-point rounding; this is the only basin checked. Documentation and checks
Every ordering, layering, partition, kernel and manner is cross-checked on the example basin, write-conflict counts included. The structures are checked against their definitions: an ordering is a topological sort, no pixel in a layer depends on another pixel of the same layer, and in an upstream-to-downstream sequence a receiver comes after its donors. These properties still hold after clipping a basin out of a region. The tests and CiteThe companion manuscript, FlowTopo v1.0: a reusable computational foundation for hyperresolution hydrology on the global 90 m MERIT Hydro drainage network (Jiang et al.), has been in open discussion for Geoscientific Model Development since 3 November 2026 as an EGUsphere preprint, 10.5194/egusphere-2026-5497. Cite it for the method; for the code cite the code record 10.5281/zenodo.23732152, or the repository with the commit you used; for a downloaded product cite its version DOI above. AcknowledgementsMERIT Hydro (Yamazaki et al., 2019) is the flow-direction grid everything here runs on. The flat downstream-pointer representation, the D8 decoding conventions, the donor-count array, the chain-tracing rank and the breadth-first sequence builder follow pyflwdir (D. Eilander, Deltares; MIT licence; 10.5281/zenodo.4287337). No pyflwdir source is included; the code was written against those conventions, and LicenceThe code is under the MIT licence. The bundled MERIT Hydro excerpt keeps its own CC BY-NC 4.0 terms (DATA_NOTICE.md). Questions: [email protected], or a GitHub issue; email reaches us faster. | ||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |