Like the Analysis Driver from the previous chapter, the chi tool is run using a parameter file. We tend to put the parameter file in the same directory as the data. We find that it is much simpler to work with one terminal window open in the directory with the source code (/path/to/LSDTopoTools/Git_projects/LSDTopoTools_ChiMudd2014/driver_functions_MuddChi2014/
) and another terminal window open in the directory with the data (/path/to/LSDTopoTools/Topographic_projects/LSDTT_workshop_data/
).
The parameter file for the chi tool is called Workshop_ChiTool.driver
. It is set up to run on the small WA.bil raster. If you want to run on the larger WAWater.bil raster you just need to change the filename in the parameter file.
The parameter file looks like this:
# Parameters for performing chi analysis
# Comments are preceeded by the hash symbol
# Documentation can be found here:
# http://lsdtopotools.github.io/LSDTT_book/#_chi_analysis_part_3_getting_chi_gradients_for_the_entire_landscape
# These are parameters for the file i/o
# IMPORTANT: You MUST make the write directory: the code will not work if it doens't exist.
read path: /LSDTopoTools/Topographic_projects/LSDTT_workshop_data/
write path: /LSDTopoTools/Topographic_projects/LSDTT_workshop_data/
read fname: WAWater
channel heads fname: NULL
# Parameter for filling the DEM
min_slope_for_fill: 0.0001
# Parameters for selecting channels and basins
threshold_contributing_pixels: 2000
minimum_basin_size_pixels: 500
test_drainage_boundaries: false
# Parameters for chi analysis
A_0: 1
m_over_n: 0.45
threshold_pixels_for_chi: 2000
n_iterations: 10
target_nodes: 80
minimum_segment_length: 10
sigma: 10.0
skip: 2
# The data that you want printed to file
only_check_parameters: false
print_stream_order_raster: true
print_DrainageArea_raster: true
print_segmented_M_chi_map_to_csv: true
print_simple_chi_map_to_csv: true
There is a whole bunch of stuff in here, which you should mostly ignore. Here are the relevant lines:
-
The lines that control the location of the files to read and write are here:
read path: /LSDTopoTools/Topographic_projects/LSDTT_workshop_data/ write path: /LSDTopoTools/Topographic_projects/LSDTT_workshop_data/ read fname: WA
You need to update these lines with your own directory structures. The
read name:
gives the prefix of the DEM. If you want the bigger dem, replaceWA
withWAWater
.Updating your parameter files the easy wayYou can update the read and write paths to reflect your own directory structure by running EITHER
python LSDTopoToolsSetup.py -id 0 -cp True
OR
python LSDTopoToolsSetup.py -id 1 -cp True
You should use the same
-id
flag you used when you first set up LSDTopoTools. -
These lines control how dense the channel network will be when you run the code:
threshold_contributing_pixels: 2000 minimum_basin_size_pixels: 500 test_drainage_boundaries: false # Parameters for chi analysis A_0: 1 m_over_n: 0.45 threshold_pixels_for_chi: 2000
The
threshold_pixels_for_chi
parameter should not be larger than thethreshold_contributing_pixels
parameter. If these parameters are small you will get many channels, if they are large you will get fewer channels.minimum_basin_size_pixels
should not be larger thanthreshold_contributing_pixels
.If you keep
A_0
equal to 1, then the chi slope will be the same as the channel steepness index,k_sn
.# The data that you want printed to file only_check_parameters: false print_stream_order_raster: true print_DrainageArea_raster: true print_segmented_M_chi_map_to_csv: true print_simple_chi_map_to_csv: true
-
The
only_check_parameters
is for bug testing: if true it will make sure your parameters will not immediately lead to a crash. -
The
print_stream_order_raster
will print a raster showing where the stream network is. -
The
print_DrainageArea_raster
will print a raster showing the drainage area. -
The two
csv
parameters are to print files that can both be read by either a GIS or by excel. Thesegmented
is more complete, it has all the information of thesimple_chi_map
and more; thesimple_chi_map
only has the chi coordinate and location of the channels.
-
The default of the chi mapping program is to only extract the chi values and slopes from the biggest basin. You can get the chi slopes and values for all basins by adding the following line to the parameter file:
only_take_largest_basin: false
You can print the chi values to a raster (rather than csv) with the line:
print_chi_coordinate_raster: true
-
If you’ve done the analysis driver exercise, this should be familiar.
-
Go into the directory where you compiled the chi tool and run:
$ ./chi_mapping_tool.exe /path/to/LSDTopoTools/Topographic_projects/LSDTT_workshop_data/ Workshop_ChiTool.driver
-
The program should spit out a bunch of text, and afterwards you will be left with some new files, which we will look at in QGIS in the next section.