Permalink
Browse files

house cleaning

  • Loading branch information...
ferrouswheel committed Apr 4, 2013
1 parent 9f3344c commit 366b08229e317ff0e955dddbab82121efe3ed170
View
@@ -13,5 +13,3 @@ MDiG 0.3.2
- Investigate problem with changing repository on Windows 7 (reported by Senait)
- Fix unit tests that relied on datetime.now() but would fail with the low
resolution of a VM clock.
-
-
View
@@ -1,7 +1,7 @@
Copyright and License Statement
MDiG is Copyright 2004-2007 Bioprotection Division, Lincoln University
- Copyright 2008 Joel Pitt
+ Copyright 2008-2013 Joel Pitt
MDiG modules require being linked to the Geographic Resources
Analysis and Support System (GRASS) Geographic Information System
View
105 README.md
@@ -1,8 +1,76 @@
# mdig - Modular Dispersal in GIS
+mdig is simulation framework designed for people modelling dispersal processes.
+In particular the focus in the past has been around modelling **invasive**
+species. For example, I have used it to [model the spread of Argentine ant in New
+Zealand, and compare it to the actual invasion dynamics][1].
+
+It has also been used to [model Buddleia daviddi][2] spread in New Zealand.
+
+mdig consists of two parts:
+
+* The simulation manager - reads a dispersal model (in XML) and works out
+ what to do. It is smart enough to:
+ * manage the running of many replications, which are important if your simulation
+ is stochastic;
+ * aggregate results;
+ * run analysis across the aggregate maps or the individual replicates;
+* The GRASS dispersal modules - these take an input distribution map, some
+ parameters, and output a new distribution map. See `grass-modules/README` for
+ more details.
+
## Setup
+### Setup GRASS
+
+Ideally you'd just go:
+
sudo apt-get install grass grass-dev
+
+But due to this bug: http://trac.osgeo.org/grass/ticket/800 the ubuntu release
+is broken. You'll need to build latest GRASS 6 development branch manually,
+until the fix for this bug propagates into Ubuntu. While there are full details
+on the GRASS GIS website, if you use Ubuntu 12.04 you should be able to get
+away with:
+
+ # Get the source code for grass 6.4.3 (development)
+ sudo apt-get install subversion
+ svn checkout https://svn.osgeo.org/grass/grass/branches/develbranch_6 grass6_devel
+ cd grass6_devel/
+
+ # Get the dependencies
+ sudo apt-get install build-essential zlib1g-dev libreadline6-dev \
+ flex bison libncurses5-dev proj libgdal-dev gdal-bin \
+ tcl8.4-dev tk8.4-dev freeglut3-dev ffmpeg libpq-dev libavcodec-dev \
+ libjpeg-dev libtiff-dev libpng12-dev postgresql libpq-dev libstdc++6 \
+ libdap-dev libgeos-dev libmysqlclient-dev libspatialite-dev \
+ libdapserver7 libgif-dev libsvn1 libjasper-dev gdal-bin uuid-dev \
+ libxerces-c2-dev libhdf5-serial-dev libgdal-dev libdb4.8 \
+ libproj-dev python-opengl unixodbc-dev fftw-dev lesstif2-dev libfreetype6-dev \
+ sqlite3 libsqlite3-dev libavcodec-dev libavformat-dev make g++ swig libxmu-dev \
+ python-dev libavutil-dev libavutil50 libswscale-dev libwxgtk2.8-dev libcairo-dev \
+ python-wxversion
+
+ # Configure
+ CHOST="x86_64-pc-linux-gnu" CFLAGS="-march=k8 -O2 -pipe -Wall" \
+ ./configure \
+ --with-tcltk-includes=/usr/include/tcl8.4 \
+ --with-motif --with-motif-includes=/usr/include/X11 \
+ --with-readline --with-cxx --with-odbc --with-sqlite \
+ --with-freetype --with-freetype-includes=/usr/include/freetype2 \
+ --without-postgres --with-proj-share=/usr/share/proj \
+ --with-ffmpeg \
+ --with-ffmpeg-includes="/usr/include/libavcodec /usr/include/libavformat /usr/include/libavutil /usr/include/libswscale" \
+ --with-wxwidgets --with-cairo --with-geos \
+ --with-python --with-postgres --with-postgres-includes=/usr/include/postgresql/ \
+ --enable-64bit 2>&1 | tee config_log.txt
+
+ # Build and install
+ make -j4
+ sudo make install
+
+### Setup mdig simulation manager
+
sudo apt-get install libxml2 libxml2-dev gsl-bin libgsl0-dev imagemagick bc
# Numpy and scipy are potentially finicky, so safest to install them separate
@@ -14,7 +82,7 @@
pip install -r requirements.txt
That's the core mdig simulation manager, but to install the custom GRASS
-modules that are particularly useful for people modelling dispersal:
+modules:
cd grass-modules
sudo make MODULE_TOPDIR=/usr/lib/grass64
@@ -26,15 +94,38 @@ Or if you installed GRASS from source, you can do something like:
cd $GRASS_SRC
make install
-## Feature requests
-
-These are the requests that I've had for MDiG to support:
-
-* [PRIORITY] Keep track of area treated by management strategies.
-
## Troubleshooting
Older versions of requirements have some bugs to be aware of:
* GRASS 6.4RC5 has an annoying g.region issue that can be confusing for new users.
+* GRASS 6.4.2 (default in Ubuntu 12.04) has a broken r.reclass that segfaults with
+ long map names.
* GDAL <1.6.0 or later, earlier versions can run into segfaults.
+
+## Testing
+
+If you wish to run the unit tests for MDiG while developing code, then go to
+the mdig program directory ('mdig/' from the root of the source) and run:
+
+ nosetests -v
+
+Or to run with code coverage analysis:
+
+ nosetests -v --with-coverage
+
+You'll run a bunch of tests to check everything's working correctly.
+
+Note - currently only basic tests are run, more rigorous tests are needed
+(although this has been greatly improved over the last year):
+
+* Additional model files that more thoroughly test the potential model types.
+* More coverage in unit tests for components within MDiG.
+* Comparison of the output maps from various models versus what the expected map
+ should look like. For modules, create before and after maps and make sure they
+ have no difference,implement as a shell script to be run within GRASS.
+
+## References
+
+[1]: http://dx.doi.org/10.1890/08-1777.1 "Predicting Argentine ant spread over the heterogeneous landscape using a spatially explicit stochastic model"
+[1]: http://dx.doi.org/10.1016/j.ecolmodel.2011.03.023 "Temporal limits to simulating the future spread pattern of invasive species: Buddleja davidii in Europe and New Zealand"
View
19 TESTING
@@ -1,19 +0,0 @@
-If you wish to run the unit tests for MDiG while developing code, then go to
-the mdig program directory ('mdig/' from the root of the source) and run:
-
- nosetests -v
-
-Or to run with code coverage analysis:
-
- nosetests -v --with-coverage
-
-You'll run a bunch of tests to check everything's working correctly.
-
-Note - currently only basic tests are run, more rigorous tests are needed
-(although this has been greatly improved over the last year):
-
-* Additional model files that more thoroughly test the potential model types.
-* More coverage in unit tests for components within MDiG.
-* Comparison of the output maps from various models versus what the expected map
- should look like. For modules, create before and after maps and make sure they
- have no difference,implement as a shell script to be run within GRASS.
View
@@ -1,14 +1,16 @@
# Analysis examples
The analysis command allows you to run GRASS/shell commands across all your maps
-and then aggregate the results.
+and then aggregate the results. Since the syntax can be tricky, this file
+documents some common use cases.
## Calculate area
-To work area of simulations (also can be used to work out whether the population
-dies out):
+To work out the area of simulations.
./mdig.py -f area -t # (not -c because this has to be per replicate)
r.stats -c %0 | awk "BEGIN {notNULL = 0} /^[^*]/ {notNULL+=\$2} END {print notNULL}"
+This can also be used to work out whether the population dies out, since you
+can then just check for zero.
View
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+GRASS_SRC=$1
+if [ ! -d "$GRASS_SRC" ]; then
+ echo "Please specify correct GRASS source/build directory"
+ exit 1
+fi
+make -S MODULE_TOPDIR=$GRASS_SRC
+cd $GRASS_SRC
+sudo make install
+cd -
View
@@ -1,40 +0,0 @@
-
-plan:
-
-We need to get data that is internal to certain modules, which means we cannot simply place all the logic in the mdig controller. The "treatments" need to support reporting the area treated.
-
-For mdig modules, this shouldn't be too difficult (although mdig scripts that use GRASS modules may be more challenging. An environment variable set in the subprocess/module wouldn't work, because the environment is local to that process.
-
-Instead, the details should be sent to a temporary file. This file could also include additional things statistics if needed later.
-
-=
-event treatments
-
-r.mdig.survival
-
-if the -e and max parameters specified, then the number of cells evaluated and actually removed are different.
-
-AREA_REMOVED=[difference in area before and after]
-AREA_EVALUATED=[maximum of cells in population being evaluated and the "max" parameter (converted to cells instead of area]
-
-==
-affect variable treatments
-
-These change the variable over the entire region specified in the <area> element.
-
-AREA_REMOVED=[difference in area before and after]
-AREA_EVALUATED=equal to the area in the <area> element, although this could change dynamically.
-
-==
-Discovered a major bug in management working with r.mdig.survival.
-
-Since r.mdig.survival uses r.mask, the use of r.mask to set the treatment area will not work!
-
-Have committed a fix, but it is untested. I really need to come up with a series of test scenarios for r.mdig.survival because the script is getting complex!
-
-- with and without seed value. test would ensure that a certain seed always produced the same result... this would be great for testing everything actually!
-
-- ensure that survival 0 means nothing is shown
-- survival 100+ means everything survives
-- survival with map 50% means that mask
-
Oops, something went wrong.

0 comments on commit 366b082

Please sign in to comment.