Calculate volume
Index polygons by point
Avoid tiny negative stages
Cleanup
Unlogged tables and single precision floats
Buffer line features to make partitions
Log polygon where point created and set PG app name
Add foreign key constraints for hypsometry and bottoms
Use correct feature id for single bottom case
Create 2-column index on volume as well as on point
Fill polygon mask when looking for min. Rewrite single bottom search with PIL.
Autodelete tiny depressions using volume threshold
Externalize lowest point search & coordinate transformation
Calculate total merged volume

This is somewhat useless but gives an idea when looking at outlines
Allow for arbitrary geometry name in partitions table
Unconditionally include merge_to column

This simplifies post-processing
Remove quotes from add_indices() so schema can be specified
Use chunksize of 1

Processing a partition takes way longer than an IPC overhead
Code cleanup
Allow few attempts while skipping elevations

Accept new polygons in other depressions in bottom discovery mode
as we go up after skipping few steps but not more than 1 m.