Everything on this page dates to 2008 and earlier. You will not need it if you get
Current version of DHSVM
DHSVM createstreamnetwork additions
This page contains several changes to the createstreamnetwork.aml package
for DHSVM
data preparation.
I wrote
parts of the initial package, but never took responsibility for it, nor
understood it completely. As I have recently been preparing data sets and
communicating on the dhsvm listserv, I found it necessary to make some changes.
First some background. Any good geographical information system like ARC/INFO
can calculate the flow direction of water across the landscape, sum the
contributing area of each cell (weighting by rainfall, if desired), and declare
cells above a certain flow level to be streams. Often, though, the DEM fails
to represent the hydrography adequately, and user imposes a mapped stream
network. I make mapped streams work by calculating
the area that flows into each stream
segment and to sum those areas as they flow downstream. As this process was
extremely clumsy in the ARC/INFO environment, I reversed-engineered the
Arc Attribute Table as a java object. (This might be the first ESRI object
ever written.)
The old version converts every grid cell to a polygon, clips the stream to
to polygons, and transfers attributes. This can take a very long time.
I am submitting changes in four components of the createstreamnetwork package:
- roadelevation.aml:
Minor changes speed execution and prevent crashes in
instances when the selection set is empty.
- rowcolmap.aml: The original version created
a polygon for every grid cell.
This version creates polygons only for cells on or near the river. It also
indexes the info files before doing relates. The result is much faster
execution.
- The java program AddAat2 is replaced by AddAatf. It takes the cell size as
an argument. It also treat the maxmsq and meanmsq variables as floating point,
preventing integer overflow when areas exceed 2147 square km. (For those not
familiar with java, source code is AddAatf.java.
It is compiled with the "javac" command to AddAatf.class
. The same .class file will run
on any machine with a java runtime environment.)
- createstreamnetwork.aml: maxmsq
and meanmsq variables are defined as
floating point, and calls are made to AddAatf.class
The variable "local" is defined as a cobol-style 4-digit integer. This can
cause non-fatal (but real) errors when a 5-digit raster value cannot be
assigned to a stream segment. I changed "local" to "b", a 4-byte integer, and
did the same for the variable wshd.
These changes improve the speed and accuracy of the package without making it
any easier to use. Visualization is weak, and error messages scroll by unseen.
Arc Macro Language and the (black window) command line are very old, and do
not support newer data structures. I'm sure others can compile a long list
of problems. I would always suggest the following integrity check:
/* areacheck.aml, if want to put it in a file.
/* Run this as a file or cut-and-paste at the Grid: prompt
&describe mask /* loading info into variables
&set cellarea = [calc %grd$dx% * %grd$dy%]
&ty [delete tmpa -info] /* Delete scratch file
statistics streamnet arc # tmpa;max maxmsq;end /* place area into tmpa
&ty Max stream area is [listunique tmpa -info MAX-MAXMSQ] square meters,
&ty or [calc [listunique tmpa -info MAX-MAXMSQ] / %cellarea%] cells
&ty The mask is [listunique mask.vat -info count] cells.
&ty [delete tmpa -info] /* Delete scratch file
Harvey Greenberg
hgreeness49@gmail.com
University of Washington
Department of Earth and Space Sciences
Box 351310
Seattle WA 98195-1310
Everything on this page dates to 2008 and earlier. You will not need it if you get
Current version of DHSVM