In order to complete the tutorial, please first clone/download the github repo which comes with the DEM, coseismic slip model, and some auxiliary files, all with the correct pathnames.
The first step in using
halfspace for topographic stress calculations is to get Python installed w/ the appropriate scientific dependencies.
Configuration of Python for scientific computing has historically been a huge pain, but recently has gotten a whole lot easier with the advent of two scientific distributions for Python that come with package managers: Canopy by Enthought, and Anaconda by Continuum Analytics. I have used Anaconda extensively, and find it a little easier because it's lighter-weight and is self-contained: it stays in a folder where you place it, doesn't touch the system Python, and doesn't require root/sudo access to install or modify packages. This means it's easy to place on shared computing resources. Best of all, it uses a package manager called
conda that is extremely easy to use.
This guide will deal exclusively with Anaconda Python.
Installing Anaconda Python.¶
There are two options for installing Anaconda Python. The first is the easiest, which just involves downloading and running a shell script (or even a gui now for OSX and Windows), will download the entire Anaconda Python distribution, which includes Python and a lot of compatible packages that are geared towards scientific computing and data visualization.
The other option is to use the Miniconda installer that will only install a very bare-bones Python, and then you can add only the necessary modules as below.
Also if you're an academic or rich or both, you can get a license for the Accelerate additions to Anaconda that include better linear algebra and GPU libraries for NumPy that can speed up computations significantly.
If the minimum Anaconda is installed (i.e. just Python and its direct dependencies), the following packages will need to be installed through the package manager
conda install ipython pandas numpy scipy matplotlib statsmodels pip gdal h5py pyzmq jinja2 tornado
Most/all of these should be available in the full Anaconda distribution if that was installed. The last three packages are not explicitly required for any of the calculations that we do, but are required for using the IPython Notebook, which is honestly the most useful tool for scientific computing since interpreted languages.
Then, install the final dependency using
pip at the command line:
pip install pyproj
Once this has all been installed, we can install
halfspace. The first step is to get it from its repository on GitHub. If you are using git, and you really should be, you can clone the repository (repo). Go to the directory you would like to clone it into (not the intended
halfspace directory, but one above that where you want to put it) and type:
git clone https://github.com/cossatot/halfspace.git
Then, go into the directory and install it with
python setup.py install
This should place the
halfspace module in the path and verify that (at least some of) it works. In the future, there will be unit tests that can be run at this time.
Table of Contents for the
- Installation and configuration
- Preparing a Digital Elevation Model file
- Preparing the coseismic slip model
- Calculating the topographic stress field
- Calculating the topographic stresses on the fault
- Bayesian inversion of tectonic stress pt. 1: Rake inversion
- Bayesian inversion of tectonic stress pt. 2: Conditions at failure