Assigning Bathymetry
Converting a 2dm file to gr3 or between gr3 or 2dm and shapefile
Assigning depths from prioritized DEMs
These tools are used by the preprocessor but also work with functions that can be used generically and consistently with SCHISM.
stacked_dem_fill
Fill node elevations in a .2dm SMS mesh or gr3 file using a prioritized list of DEMs.
usage: stacked_dem_fill [-h] [--elev2depth] [--fill FILL] filename demfile
Positional Arguments
- filename
name of 2dm or gr3 file
- demfile
file containing list of DEMs. These can be in any form that gdal accepts, which includes ESRI ascii format and GeoTiffs
Named Arguments
- --elev2depth
Convert elevation to depth by flipping sign. This is typical when using gr3 format, less so with 2dm.
Default: False
- --fill
Fill value for areas not covered by supplied rasters.
Default: 2.0
Smoother for complex topography
Often it is necessary to incorporate inudated marshy areas where elevations are poorly sampled and contours are tortuous. The script contour_smooth.py uses minmax curvature flow (Malladi and Sethian) to impose a minimum length scale of change for contours, essentially unraveling the features that are most contorted.
Uses the min-max curvature flow algorithm of Malladi and Sethian to simplify DEM topograph The script requires a subcommand like: $ contour_smooth.py smooth The most basic subcommand is smooth. Given limited efficiency at the moment, the script is generally run on a small area and dumps intermediate points in the processing as numpy arrays so you can view the differences using the contour_smooth.py view subcommand. You can get subject-specific help on a subcommand by typing $ model_time.py subcommand –help
usage: contour_smooth [-h] {smooth,view,save} ...
subcommands
- subcommand
Possible choices: smooth, view, save
sub-commands indicating the particular action required.
Sub-commands
smooth
Smooth the input DEM.
contour_smooth smooth [-h] [--input INPUT] [--scales [SCALES ...]]
[--nstep NSTEP] [--max_time MAX_TIME]
[--report_interval REPORT_INTERVAL]
Named Arguments
- --input
Input file name, file in tiff format.
- --scales
Scales (in multiples of DEM side length) over which to smooth. The sequence [1,2,3,4] is an example, where the smoothing is gradually introduced at 10m, 20m, 30m and 40m for a 10m DEM.
Default: [1, 2]
- --nstep
number of pseudo time steps to resolve integration. Default of 160 is recommended.
Default: 40
- --max_time
Pseudo time representing final time step. 2.0 is the default.
Default: 4.0
- --report_interval
Intermediate interval at which integration will be segmented and smoothed DEMs will be dumped. So if –max_time is 2.0 and –report_interval is 0.1 you will get 20 intermediate reports.
Default: 1.0
view
View two versions of the smoothed DEM based on their .npy dump.
contour_smooth view [-h] [--levels [LEVELS ...]] [--vmin VMIN] [--vmax VMAX]
file0 file1
Positional Arguments
- file0
First file in .npy format.
- file1
Second file in .npy format.
Named Arguments
- --levels
Contour levels
Default: [-4, -3, -2, -1, 0, 1]
- --vmin
Minimum elevation in color bar
Default: -6.0
- --vmax
Maximum elevation in color bar
Default: 4.0
save
save dumped DEM based on .npy dump and the original DEM it came from.
contour_smooth save [-h] [--dumpfile DUMPFILE] [--original ORIGINAL]
[--outfile OUTFILE]
Named Arguments
- --dumpfile
Dump file from smoothing (npy format)
- --original
Original DEM (GeoTiff).
- --outfile
Output file that will be saved (GeoTiff format).
Optimizing depths for volume
A mesh draped over noisy bathymetry data does not necessarily represent important moments such as volumes and vertical face areas smoothly and realistically. To better represent these facets of the geometry, we compare the volumetric quantities that come from SCHISM shape functions (which are much like a TIN) to a higher order quadrature using the DEM with bilinear interpolation. The quadrature is more accurate, and also incorporates more sample points.