Finding valley thalweg coordinates and elevations


During the past 3 days I have:

1. Code refactoring

Classes have been created for all data and plot types which can be referenced from the main programs. The code currently consists of the following 7 files:

In addition, there is another complete GUI program called 'GetCoords.py' which is used to semi-automatically digitize the valley bounding curves from processed raster images, and to create the centerline from which the valley steps are derived. At some time in the future, it is hoped to completely automate this process.

At some point in the near future, I will need to create documentation and a tutorial on how to run all these programs, especially GetCoords.py. This will be a non-trival task. For now, the seven files listed above are available for your perusal, without documentation, here.

2. Finding thalweg coordinates and elevations

The newest program is PlotValley.py, which does much more than that. It reads files for the DEM, valley curves, and bedrock points, and constructs perpendicular steps along the valley centerline, associates known bedrock points with stream length, and locates the minimal elevation and coordinates across each step. This information will then be used to create 3d cells consisting of valley steps and segments of the left and right walls as sides, and the surface DEM and derived bedrock elevations as the tops and bottoms of these volumes.

This program can read a DEM file as either text or processed binary (e.g. previously smoothed, see DEM class in Data.py for details), which speeds up execution considerably. The known bedrock locations are also read as another DEM file. Curve coordinates for valley walls and centerline are read in text format, and are the output of the GetCoords.py program (see MNRR project blogs for 5/23/08 and 5/30/08 for description). Here is an example of this output. This file is in screen coordinates, and is converted to actual coordinates (meters) using the DEM origin and cell size.

Here is an example of running this program:

> PlotValley.py ../Data/lknl_dem_asci.dat ../Data/lkc.curves ../Data/lknl_br_asc.txt
Reading:  ../Data/lknl_dem_asci.dat
Loading from: ../Data/lknl_dem_asci.dat
Header:  {'ncols': 1483, 'cellsize': 2.0, 'nrows': 861, 'xllcorner': 438725.34841312002, 'yllcorner': 4868597.9428097, 'NODATA_value': -9999.0}
Array shape:  (861, 1483)
Valid elements:  347337
Min = 67.1252, max = 256.857, mean = 134.981, std = 39.734
Read 3 curves:
   left: 174 pts, 3445.24 m
   right: 174 pts, 3443.28 m
   center: 171 pts, 3387.05 m
Reading:  ../Data/lknl_br_asc.txt
Header:  {'ncols': 2220.0, 'cellsize': 1.0, 'nrows': 1155.0, 'xllcorner': 439274.10786226002, 'yllcorner': 4868617.6905073998, 'NODATA_value': -9999.0}
Array shape:  (1155, 2220)
Valid elements:  36
Min = 0, max = 35, mean = 17.5, std = 10.3883
36 bedrock pts
Calculating path vectors...
171 vectors
Calculating wall intersections...
Calculating bedrock coordinates and elevations...
               x                y                z                s
---------------- ---------------- ---------------- ----------------
   439345.107862   4869771.690507        73.089530      2684.452298
   439274.107862   4869770.690507        72.547825      2733.906853
   439302.107862   4869770.690507        71.628812      2718.865331
   439399.107862   4869751.690507        73.636956      2623.982822
   439449.107862   4869730.690507        74.784348      2559.527192
   439590.107862   4869718.690507        75.634824      2427.501006
   439468.107862   4869717.690507        76.203120      2537.534766
   439503.107862   4869717.690507        75.101487      2506.803748
   439607.107862   4869707.690507        75.243385      2407.865874
   439629.107862   4869696.690507        76.864652      2383.231314
...
Calculating thalweg coordinates and elevations...
               x                y                z                s
---------------- ---------------- ---------------- ----------------
   441484.962117   4868641.849659       111.928576         0.000000
   441499.696638   4868658.362687       111.523200        19.995710
   441498.681231   4868679.803017       110.464328        39.993051
   441490.145996   4868702.269767       110.327356        59.992682
   441491.984597   4868723.002980       109.724272        79.991224
   441507.672210   4868739.552913       108.961800        99.984174
   441491.947552   4868763.856080       108.792740       119.970960
   441498.181493   4868776.653479       108.929168       139.920009
   441503.804550   4868794.478027       108.214212       159.841775
   441502.629999   4868814.006113       107.531880       179.822388
...

The visual output of this program is two plots showing the locations and elevations of the valley curves, steps, and bedrock points:


(Click for larger image)

In this plot, the left and right bounds are in blue, the centerline is in red, the known bedrock points are in green, and the valley steps and location of the thalweg (minimum point on each step) are in yellow. It is also possible to delete any step lines which intersect within the valley bounds. In this case, only one step would be removed (in left bend at tributary near upper left of plot). Although this is not required to calculate elevations, crossing steps must be removed when cell perimeters are calculated.

In addition, elevation vs. path length is shown for all of the above:


(Click for larger image)

Note the following:

  1. The bedrock points are sparsely distributed, and are not sufficient to estimate the bedrock elevation throughout the entire valley. At least one bedrock point is outside the DEM, and is not used.

  2. The thalweg curve correlates strongly with known bedrock points. Therefore, it might be used to estimate the elevation of other bedrock points throughout the entire valley length.

  3. The thalweg elevation is below almost all of the bedrock points. At least one bedrock point is above the centerline elevation, and is therefore spurious.

  4. Where bedrock points are present, and below the thalweg, they can be used to determine the elevation of cell bottoms. Where bedrock points are absent, or are above the thalweg, the latter can be used to determine the elevation of cell bottoms.

This information:

should be sufficient to create polygonal prismatic cells and begin to calculate sediment volumes at each stream length, although the exact geometry of the bedrock floor and valley sides is still to be determined. However, with these as variable factors, and using simple approximations (e.g. average elevation or planar trend as base and vertical sides) I should be able to perform some initial volume calculations next weekend.


© Sky Coyote 2008.