5. Tutorial 2: LSDTopoTools analysis driver: getting and compiling the program

LSDTopoTools is a collection of tools for the analysis of topographic and spatially distributed data developed in the University of Edinburgh School of GeoSciences.

The code has been developed to conduct reproducible research in geomorphology, hydrology and ecology.

Most users will run the code using the program LSDTT_analysis_from_paramfile.out. These tutorials focus on analysis using this program.

5.1. Getting the source code

5.1.1. Instructions for inexperienced linux users

If you know what you are doing in linux jump ahead to here Instructions for experienced linux users

First, you have to get the source code. There is a vague plan to make binaries available, but for the time being you will need to compile the code on your own Linux computer. If you are in the University of Edinburgh’s School of GeoSciences this should be relatively easy.

The code should theoretically run compile on both a Mac (it has a Linux backend) or Windows. For Windows you’ll need to download the gnu c++ compiler using cygwin. However, we use Linux because that is the operating system on our servers at the University of Edinburgh, and all of these instruction are specific to Linux.

If you do manage to compile these programs on Windows or MacOS email me (Simon M. Mudd) and I’ll post the tutorial on this website.

  1. The first thing you want to do is open a terminal window: Getting onto our servers using NX.

  2. Now, using cd to change directories and cd .. to go up a directory, find somewhere to put the code.

  3. Once you have found a good place to put your code, make a new directory for it using mkdir, for example:

    mkdir topographic_analysis
  4. If you forgot what folder you are in, you can find it with the pwd command. Here is a typical sequence of commands:

    smudd@burn topographic_tools $ mkdir topographic_analysis
    smudd@burn topographic_tools $ cd topographic_analysis/
    smudd@burn topographic_analysis $ pwd
    /home/smudd/topographic_tools/topographic_analysis
    smudd@burn topographic_analysis $
  5. Now you need to download the zipped source code. You do it like this:

    wget http://www.geos.ed.ac.uk/~smudd/LSDTopoToolbox_driver/LSDTT_analysis.zip
  6. This will download the zipped code. If you type ls (to list files in your directory) you can see that the zipped code is there:

    smudd@burn topographic_analysis $ wget http://www.geos.ed.ac.uk/~smudd/LSDTopoToolbox_driver/LSDTT_analysis.zip
    --2014-09-25 13:12:50--  http://www.geos.ed.ac.uk/~smudd/LSDTopoToolbox_driver/LSDTT_analysis.zip
    Resolving www.geos.ed.ac.uk... 129.215.8.163
    Connecting to www.geos.ed.ac.uk|129.215.8.163|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 321850 (314K) [application/zip]
    Saving to: `LSDTT_analysis.zip'
    
    100%[======================================>] 321,850     --.-K/s   in 0.006s
    
    2014-09-25 13:12:50 (48.0 MB/s) - `LSDTT_analysis.zip' saved [321850/321850]
    
    smudd@burn topographic_analysis $ ls
    LSDTT_analysis.zip
  7. You can now use the linux unzip command to unzip the source code:

    unzip LSDTT_analysis.zip
  8. It will quickly unzip everything. Now if you type ls you will see a bunch of new stuff:

    smudd@burn topographic_analysis $ ls
    analysis_driver        LSDIndexChannel.hpp                LSDRaster.hpp
    LSDAnalysisDriver.cpp  LSDIndexRaster.cpp                 LSDShapeTools.cpp
    LSDAnalysisDriver.hpp  LSDIndexRaster.hpp                 LSDShapeTools.hpp
    LSDChannel.cpp         LSDJunctionNetwork.cpp             LSDStatsTools.cpp
    LSDChannel.hpp         LSDJunctionNetwork.hpp             LSDStatsTools.hpp
    LSDFlowInfo.cpp        LSDMostLikelyPartitionsFinder.cpp  LSDTT_analysis.zip
    LSDFlowInfo.hpp        LSDMostLikelyPartitionsFinder.hpp  TNT
    LSDIndexChannel.cpp    LSDRaster.cpp
    smudd@burn topographic_analysis $
  9. These are the source files. Note if you are at Edinburgh and you have access to your `T:` or `M:` drives you could do all this stuff in Windows explorer. But you should get used to using the terminal so this is good practice.

5.1.2. Instructions for experienced linux users

  1. You will already have a terminal window open, because you feel cold and empty without one.

  2. Make a directory for the code.

  3. Download it:

    wget http://www.geos.ed.ac.uk/~smudd/LSDTopoToolbox_driver/LSDTT_analysis.zip
  4. Unzip:

    unzip LSDTT_analysis.zip
  5. Move on to the next bit.

5.2. Compiling the source code

Unzipping the source code created a directory called analysis driver. Go into this directory:

cd analysis_driver

and run make, by typing this:

make -f Drive_analysis_from_paramfile.make

You should now have a program called LSDTT_analysis_from_paramfile.out.

You are now ready to move on to the next step: performing your first analysis!