Skip to content

Commit 42d9651

Browse files
committed
Additions to the chi analysis documentation and various typo fixes
1 parent e510a8f commit 42d9651

File tree

8 files changed

+147
-42
lines changed

8 files changed

+147
-42
lines changed

Book_script.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# You need to do this offline since bundler doesn't work on UEdin servers!
66

77
# sync the files on the web server
8-
rsync -a ./images/ /web/smudd/public_html/LSDTT_book/Images
8+
rsync -a ./images/ /web/smudd/public_html/LSDTT_book/images
99
rsync -a ./LSDTT_docs.html /web/smudd/public_html/LSDTT_book/LSDTT_docs.html
1010
rsync -a ./LSDTT_docs.pdf /web/smudd/public_html/LSDTT_book/LSDTT_docs.pdf
1111

book/03-Preliminary-Steps/sections/GDAL.asc

+6-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The preferred coordinate system is WGS84 UTM coordinates. For convert to
6969
this coordinate system you use `gdalwarp`. The coordinate system of the
7070
source raster can be detected by gdal, so you use the flag `-t_srs` to
7171
assign the target coordinate system. Details about the target coordinate
72-
system are in quotes, you want::
72+
system are in quotes, you want:
7373

7474
[source,consol]
7575
-----------------------------------
@@ -93,15 +93,15 @@ Put this together with a source and target filename:
9393
$ gdalwarp -t_srs '+proj=utm +zone=XX +datum=WGS84' source.ext target.ext
9494
-------------------------------------------------------------------------
9595

96-
so one example would be::
96+
so one example would be:
9797

9898
[source,consol]
9999
-------------------------------------------------------------------------------------------------------
100100
$ gdalwarp -t_srs '+proj=utm +zone=44 +datum=WGS84' diff0715_0612_clip.tif diff0715_0612_clip_UTM44.tif
101101
-------------------------------------------------------------------------------------------------------
102102

103103
note that if you are using UTM and you are in the southern hemisphere,
104-
you should use the `+south` flag::
104+
you should use the `+south` flag:
105105

106106
[source,consol]
107107
------------------------------------------------------------------------------------------------------------------
@@ -159,7 +159,7 @@ contributing pixels. (GDAL >= 1.10.0)
159159
** `mode`: mode resampling, selects the value which appears most often
160160
of all the sampled points. (GDAL >= 1.10.0)
161161
+
162-
So for example you could do a cubic resampling with::
162+
So for example you could do a cubic resampling with:
163163
+
164164
[source,consol]
165165
----
@@ -170,7 +170,7 @@ diff0715_0612_clip.tif diff0715_0612_clip_UTM44_rs4.tif
170170
* `-te` `<x_min> <y_min> <x_max> <y_max>`: this clips the raster. You
171171
can see more about this below in :ref:`Clip-using-gdal`.
172172
* **UTM South**: If you are looking at maps in the southern hemisphere,
173-
you need to use the `+south` flag::
173+
you need to use the `+south` flag:
174174
+
175175
[source,consol]
176176
----
@@ -204,14 +204,12 @@ $ gdal_translate -of ENVI diff0715_0612_clip_UTM44.tif diff0715_0612_clip_UTM44.
204204
Where the first `filename.ext` is the source file and the second is the
205205
output file.
206206

207-
.. _Clip-using-gdal:
208-
209207
[[potential-filename-errors]]
210208
===== Potential filename errors
211209

212210
It appears that GDAL considers filenames to be case-insensitive, which
213211
can cause data management problems in some cases. The following files
214-
are both considered the same::
212+
are both considered the same:
215213

216214
[source,consol]
217215
-------------------------------

book/03-Preliminary-Steps/sections/data-sources.asc

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ and because it retains georeferencing information.
4040
.Why don't we use GeoTiff?
4141
****
4242
https://trac.osgeo.org/geotiff/[GeoTIFF] is a widely used raster format that has the advantage of containing georeferencing and the raster data in a single file.
43-
The disadvantage is that for pass:[c++] code you need to have two libraries (`libtiff` and `libgeotiff`) installed before you can read GeoTIFF files.
43+
The disadvantage is that for pass:[C++] code you need to have two libraries (`libtiff` and `libgeotiff`) installed before you can read GeoTIFF files.
4444
Because there are many open source, easily installed tools for converting GeoTIFF files
4545
(for example, the http://www.gdal.org/gdal_utilities.html[GDAL utilities] and the https://pypi.python.org/pypi/GDAL/[python GDAL bindings])
4646
we have opted for portability and not included the GeoTIFF libraries in our software. If you have GeoTIFF files, you
@@ -109,16 +109,16 @@ There are several global topographic datasets. The oldest of these is https://lt
109109
which was completed in 1996 and contains ~1 km resolution global data.
110110
This was followed by the https://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Mission[Shuttle Radar Topography Mission (SRTM)]
111111
that produced a 90 meter resolution DEM in 2003; followed by the
112-
https://asterweb.jpl.nasa.gov/gdem.asp[Advanced Spaceborne Thermal Emission and Rerflection Radiometer (ASTER)]
112+
https://asterweb.jpl.nasa.gov/gdem.asp[Advanced Spaceborne Thermal Emission and Reflection Radiometer (ASTER)]
113113
30 meter resolution global DEM in 2009. In 2014
114114
http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1[SRTM released a global 30 meter dataset].
115115
2015 has seen the release of the http://www.geo-airbusds.com/worlddem/[WorldDEM], a 12 meter resolution topographic dataset.
116116
117117
GTOPO30, SRTM and ASTER data are all freely available for download. The WorldDEM is a commercial product.
118-
If you are looking for a global dataset at reasonable resolution that is not commercial, you will most likeley choose between ASTER and SRTM.
118+
If you are looking for a global dataset at reasonable resolution that is not commercial, you will most likely choose between ASTER and SRTM.
119119
You can download ASTER and SRTM data at the same site and make your own comparisons,
120120
but ASTER has widely publicised http://www.digital-geography.com/dem-comparison-srtm-3-vs-aster-gdem-v2/#.ViS2wX6rRaQ[data quality issues]
121-
so we reccomend the SRTM 30 meter data.
121+
so we recommend the SRTM 30 meter data.
122122
****
123123

124124

book/Chi-Analysis/images/Thumbs.db

32.5 KB
Binary file not shown.

book/Chi-Analysis/sections/background.asc

+5
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ If you are familiar with chi analysis, you can skip ahead to the section <<Get a
99
This section covers the background to the method, and why it is useful.
1010

1111
==== Topographic expression of climate, tectonics, and lithology
12+
13+
Sorry the sicetion is under construction! But if you want to read more about chi analysis, have a look at these papers:
14+
http://web.mit.edu/perron/www/files/PerronRoyden13.pdf[Perron and Royden, 2013];
15+
http://web.mit.edu/perron/www/files/RoydenPerron13.pdf[Royden and Perron, 2013];
16+
http://onlinelibrary.wiley.com/doi/10.1002/2013JF002981/abstract[Mudd et al., 2014].

book/Chi-Analysis/sections/get-the-code.asc

+41
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,45 @@ $ cd driver_functions_MuddChi2014
5454
There are a number of makefiles (thse with extension `.make` in this folder).
5555
These do a number of different things that will be explained later in this chapter.
5656
We will compile them as we go through the various different types of chi analysis.
57+
58+
==== Get some example data
59+
60+
We are going to use example data from the Mandakini River in Northern India.
61+
This river was the focus of a study by Rahul Devrani and others, you can find it here:
62+
http://onlinelibrary.wiley.com/doi/10.1002/2015GL063784/full (the paper is open access).
63+
64+
Again, we want to make sure our data is arranged somewhere sensible.
65+
Make a directory for datasets and perhaps a folder specific to India.
66+
Again, you don't need to follow the same naming conventions as in these examples,
67+
but you will have to remember the directory names!
68+
69+
I would open a second terminal window (one should already be open in the *driver_functions_MuddChi2014* folder)
70+
and navigate to the data folder:
71+
72+
[source,console]
73+
----
74+
$ cd /home/LSDTT_Data/India/
75+
----
76+
77+
The SRTM data from the catchment is stored on the data repository at GitHub:
78+
https://github.com/LSDtopotools/ExampleTopoDatasets.
79+
80+
You probably don't want to clone this repository since it contains a lot of DEMs,
81+
so why don't you just download the relevant files directly:
82+
83+
[source,console]
84+
----
85+
$ wget https://github.com/LSDtopotools/ExampleTopoDatasets/raw/master/Mandakini.bil
86+
$ wget https://github.com/LSDtopotools/ExampleTopoDatasets/raw/master/Mandakini.hdr
87+
----
88+
89+
We are also going to use a parameter file, which can be grabbed from Github:
90+
91+
[source,console]
92+
----
93+
$ wget https://github.com/LSDtopotools/ExampleTopoDatasets/raw/master/example_parameter_files/Mandakini.driver
94+
----
95+
96+
Okay, you are now ready to move on to the examples.
97+
5798

book/Chi-Analysis/sections/getting-profiles.asc

+89-29
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,26 @@ the toolkit takes the raw DEM and prints several derived datasets from it.
3838
The main dataset used for the next step is the junction index dataset.
3939
The second step involves selecting a junction from which the chi analysis proceeds.
4040

41-
===== Writing junctions
4241

42+
===== Compiling the source code for junctions and channels
4343

44-
. First, create a folder for your DEM.
45-
+
46-
For this example I am working in the Mandakini river, a tributary of the Ganga in the Indian Himalaya.
47-
Make sure both the `.flt` and the `.hdr` file are in this folder.
48-
Then you need to create a file that tells the analysis the name of the DEM and a few parameters.
44+
. This example will use the files that we downloaded in the previous section.
45+
If you have your own files, you will need to substitites the correct file and directory names.
4946
+
50-
You can name this file anything you like but I have called mine ``chi_parameters.driver``:
47+
. Make sure the necessary files are in your directory:
5148
+
5249
[source,console]
5350
----
5451
$ pwd
55-
/home/smudd/topographic_tools/test_suites/Mandakini
52+
/home/LSDTT_Data/India/
5653
5754
$ ls
58-
chi_parameters.driver mandakini.flt mandakini.hdr
55+
Mandakini.driver Mandakini.bil Mandakini.hdr
5956
----
6057
+
6158
. The driver file must contain three lines.
6259
The first line is the name of the DEM without the extension.
63-
In this example the name is `mandakini`. The next line is a minimum slope for the fill function.
60+
In this example the name is `Mandakini`. The next line is a minimum slope for the fill function.
6461
The default is 0.0001.
6562
The third line is the threshold number of pixels that contribute to another pixel before that pixel is considered a channel.
6663
You can play with these numbers a bit, in this example, I have set the threshold to 300
@@ -74,8 +71,59 @@ mandakini
7471
300
7572
----
7673
+
77-
. Once you have done this, you need to run the driver program.
78-
The driver program is called `chi1_write_junctions.exe`.
74+
You can check this in Linux with the `less` command. Just type `less Mandakini.drver` to see the file and `q` to quit.
75+
+
76+
. Okay, if you have been following along, you should have two terminal windows open. One should be open in the folder containing your data, and the other should be open in the folder with the source code driver functions.
77+
+
78+
[cols="1,1", options="header"]
79+
.The two terminal windows
80+
|===
81+
|Data terminal window
82+
|Source code terminal window
83+
84+
a|[source,paramfile]
85+
----
86+
$ pwd
87+
/home/LSDTT_data/India/
88+
$ ls
89+
Mandakini.driver Mandakini.bil Mandakini.hdr
90+
----
91+
92+
a|
93+
[source,paramfile]
94+
----
95+
$ pwd
96+
/home/LSDTT_repositories/LSDTopoTools_ChiMudd2014/driver_functions_MuddChi2014/
97+
$ ls
98+
chi_get_profiles_driver.cpp
99+
chi_get_profiles.make
100+
chi_m_over_n_analysis_driver.cpp
101+
chi_m_over_n_analysis.make
102+
chi_step1_write_junctions_driver.cpp
103+
chi_step1_write_junctions.make
104+
chi_step2_write_channel_file_discharge.cpp
105+
chi_step2_write_channel_file_discharge.make
106+
chi_step2_write_channel_file_driver.cpp
107+
chi_step2_write_channel_file.make
108+
----
109+
110+
|===
111+
+
112+
. In the source code terminal window, you need to compile two programs (step1 and step2):
113+
+
114+
[source,console]
115+
----
116+
$ make -f chi_step1_write_junctions.make
117+
<<Lots of warnings that you can ignore>>
118+
$ make -f chi_step2_write_channel_file.make
119+
----
120+
+
121+
. This will make two programs, *chi1_write_junctions.exe* and *chi2_write_channel_file.exe*.
122+
Once you have done this, you need to run the driver program.
123+
124+
===== Writing junctions
125+
126+
. For writing junctions, the driver program is called `chi1_write_junctions.exe`.
79127
It takes 2 arguments.
80128
The first is the path name into the folder where your data is stored, and the second is the name of the driver file.
81129
To run the program, just type the program name and then the path name and driver file name.
@@ -87,10 +135,10 @@ Here is a typical example:
87135
+
88136
[source,console]
89137
----
90-
./chi1_write_junctions.exe /home/smudd/topographic_tools/test_suites/Mandakini/ chi_parameters.driver
138+
$ ./chi1_write_junctions.exe /home/LSDTT_data/India/ Mandakini.driver
91139
----
92140
+
93-
IMPORTANT: To run the code you need to be in the folder containing the `.exe` file, **NOT** the folder with the data.
141+
IMPORTANT: To run the code you need to be in the source code folder containing the `.exe` file, **NOT** the folder with the data.
94142
+
95143
All the output from the software, however, will be printed to the data folder. *That is, the software and data are kept separately.*
96144
+
@@ -113,9 +161,13 @@ So your directory will be full of files like this:
113161
[source,console]
114162
----
115163
$ ls
116-
chi_parameters.driver mandakini.flt mandakini_HS.hdr mandakini_SO.flt
117-
mandakini_fill.flt mandakini.hdr mandakini_JI.flt mandakini_SO.hdr
118-
mandakini_fill.hdr mandakini_HS.flt mandakini_JI.hdr
164+
Mandakini.hdr Mandakini.driver
165+
Mandakini.bil Mandakini_HS.bil
166+
Mandakini_CP.bil Mandakini_HS.hdr
167+
Mandakini_CP.hdr Mandakini_JI.bil
168+
Mandakini_JI.hdr
169+
Mandakini_fill.bil Mandakini_SO.bil
170+
Mandakini_fill.hdr Mandakini_SO.hdr
119171
----
120172
+
121173
. You will then need to load these files into ArcMap and look at them.
@@ -136,15 +188,17 @@ The stream order raster will display the channel network, with each channel havi
136188
In the image below, the channel network is in cool colours and the junctions are in warm colours.
137189
Each junction has a unique integer value, called the junction index.
138190
+
139-
.. image:: ./_images/Chi_profiles/Mandakini_stream_network.jpg
191+
.Stream network, with junctions in red and orange pixels
192+
image::images/Mandakini_stream_network.jpg[Stream network]
140193
+
141194
. Now, find the part of the map where you want to do the chi analysis.
142195
You need to choose the junction at the downstream end of the channels where you will do your analysis.
143196
Use the identify tool (it looks like an ```i``` in a blue circle on ArcMap)
144197
to get the number of the junction that you want to use as the lowest junction in the channel network.
145198
In the below image the arrow points to junction number 51.
146199
+
147-
.. image:: ./_images/Chi_profiles/Mandakini_select_junction.jpg
200+
.Finding the junction number
201+
image::images/Mandakini_select_junction.jpg[Finding a junction]
148202
+
149203
. Each junction has one and only one receiver junction, whereas it can have multiple donor junctions.
150204
When you choose a junction, the extracted channel traces down to the node one before the receiver junction.
@@ -161,15 +215,15 @@ Before you run this program, you need to write a file that contains the paramete
161215
The code does not check this so you need to make sure on your own this is the case.
162216

163217
. The next two rows of the driver file are the junction number from which you want to extract the network.
164-
and something that controls how the channel network is ```pruned```.
218+
and something that controls how the channel network is "pruned".
165219
This is the ratio in area between the main stem and a tributary that must be exceeded for a tributary to be included in the analysis.
166220
If this number is 1 you only get the main stem.
167221
The smaller the number the more tributaries you get. A reasonable number seems to be `~0.02`.
168222
Here is an example file:
169223
+
170224
[source,paramfile]
171225
----
172-
mandakini
226+
Mandakini
173227
0.0001
174228
300
175229
51
@@ -182,7 +236,7 @@ it only looks at the first 5 lines of the driver function.
182236
+
183237
. From here you run the program `chi2_write_channel_file.exe`.
184238
You need to include the path name and the name of the chi parameter file.
185-
In Linux the program should be proceeded with `./`. Here is an example::
239+
In Linux the program should be proceeded with `./`. Here is an example:
186240
+
187241
[source,console]
188242
----
@@ -200,17 +254,20 @@ drained by the extracted channel network.
200254
+
201255
ArcMap should be able to see the '.csv' file.
202256
+
203-
.. image:: ./_images/Chi_profiles/channel_csv.jpg
257+
.Adding a csv file in ArcMap
258+
image::images/channel_csv.jpg[Load a csv file]
204259
+
205260
If you load this layer and right click on it, you should be able to load the xy data
206261
+
207-
.. image:: ./_images/Chi_profiles/csv_show_xy.jpg
262+
.Showing x and y data in ArcMap
263+
image::images/csv_show_xy.jpg[Show xy data in ArcMap]
208264
+
209265
Loading the csv file will give you a shapefile with the channel nodes, and loading the `_basin_`
210266
file will give you the basin. Here is the basin and the channel for junction `51` of the
211267
Mandakini dataset
212268
+
213-
.. image:: ./_images/Chi_profiles/Mandakini_extracted_chan_and_basin.jpg
269+
.The extraced basin with its channels
270+
image::images/Mandakini_extracted_chan_and_basin.jpg[Channel and basin]
214271
+
215272
Note how the channel extends downstream from the selected junction. It stops one node before the
216273
next junction. This way you can get an entire tributary basin that stops one node short of its
@@ -219,10 +276,10 @@ confluence with the main stem channel.
219276

220277
===== Format of the .chan file
221278

222-
The segment fitting algorithm (see part 2) works on a ```channel``` file (we use the extension `.chan` to denote a channel file).
279+
The segment fitting algorithm (see part 2) works on a "channel" file (we use the extension `.chan` to denote a channel file).
223280
The channel file starts with six lines of header information that is used to reference the channel to a DEM.
224281
f the channel is not generated from a DEM these six rows can contain placeholder values.
225-
The six rows are::
282+
The six rows are:
226283

227284
[cols="1,3", options="header"]
228285
.File input and output options
@@ -281,9 +338,10 @@ Columns are separated by spaces so rows will have the format:
281338
Chan_number receiver_chan receiver_node node_index row col flow_dist elev drainage_area
282339
----
283340

284-
Here are the first few lines of the example file (`mandakini_ChanNet_51.chan`):
341+
Here are the first few lines of the example file (`Mandakini_ChanNet_51.chan`):
285342

286343
[source,paramfile]
344+
----
287345
648
288346
587
289347
290249.625
@@ -299,7 +357,9 @@ Here are the first few lines of the example file (`mandakini_ChanNet_51.chan`):
299357
0 0 271 5799 76 323 70683.39844 4571 3936087.25
300358
0 0 271 5992 77 324 70557.79688 4565 3975527
301359
0 0 271 6190 78 325 70432.19531 4564 3983414.75
360+
----
302361

303-
Now that you have the `.chan` file you are ready to move to part 2 of the chi analysis (:ref:`Chi-part-2`).
362+
Now that you have the `.chan` file you are ready to move to the next section of the chi analysis:
363+
<<Chi profile analysis, part 2: constraining m/n and transforming profiles>>.
304364
This may have seen like quite a few steps, but once you get familiar with the workflow the
305365
entire process should take no more than a few minutes.

book/preface.asc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[preface]
2+
23
== Preface by Simon M. Mudd
34

45
Welcome to the documentation of the https://lsdtopotools.github.io/[LSDTopoTools].

0 commit comments

Comments
 (0)