Instructions

Evan Gowan
June 7, 2016
evangowan@gmail.com

----

Note, if you use this, please cite my papers:

Gowan, E.J., Tregoning, P., Purcell, A., Lea, J., Fransner, O.J., Noormets, R. and Dowdeswell, J.A., 2016. ICESHEET 1.0: a program to produce paleo-ice sheet reconstructions with minimal assumptions. Geoscientific Model Development, 9(5), pp. 1673-1682, doi:10.5194/gmd-9-1673-2016

Gowan, E.J., Tregoning, P., Purcell, A., Montillet, J.-P., and McClusky, S., 2016. A model of the western Laurentide Ice Sheet, using observations of glacial isostatic adjustment. Quaternary Science Reviews, 139, pp. 1-16, doi:10.1016/j.quascirev.2016.03.003

-----

As noted on the instructions page for ICESHEET (https://raisedbeaches.net/2016/05/22/icesheet-1-0/), you must have 
GMT 5 (http://gmt.soest.hawaii.edu/) and NETCDF tools (http://www.unidata.ucar.edu/software/netcdf/software.html#netcdf_tools)
in order to create the input binary grid files. Make sure to download and install those first. You also need to have icesheet, nearest_int
and reduce_dem compiled and put into ${PATH} before you start (see step 2)

Note, for convenience, I have included a bin directory with pre-compiled versions of all the programs that are needed. Just dump those
binaries somewhere in ${PATH}. They should work in recent versions of Linux.

Steps:

1) First, go into the "shear_stress_domains" folder and run "convert_text.sh". You may have to recompile "create_ss_grid"
on your system. Also included are the shapefiles for all of North America that I used. You are entirely free to
edit the shapefile to create your own domains, instructions to export the file that is used in convert_text.sh
are included in that script. Note that if you add domains, you will have to also add them in the shear stress
model file that is used in later steps. Running this script will create a large text file called 'domains.txt',
which will be used later. For the NAICE model here, it ends up being about 77 MB (which is why I am not distributing
the example with it already created). It should take less than a minute to run, and only has to be executed once.


2) There are several binaries that need to be put somewhere in ${PATH} before running the scripts. One is the program
"ICESHEET", which is not included (download from raisedbeaches.net, or from http://www.geosci-model-dev.net/9/1673/2016/). If you want
to test out the GIA deformation, you also have to compile the program "site_to_txt", which is in a folder in this archive. "merge_ice_models"
will create an input file for calsea (the ANU sea level calculator). I tend to
use a local directory to put the binaries in, which can be edited in the run scripts (see step 3)

3) Next go into the "run" folder. There will be a bunch of script files, you must go into all of them and edit
the bin directory where you have stored the binaries (if it isn't somewhere that is already defined in
the $PATH variable). You also need to change the "current_folder" variable in each script to be where you have
stored the root directory (i.e. where this file is).


4) Editing the shear stress model file is pretty easy. Open up the file (which is 20009.csv, which contains the values used for NAICE)
in a spreadsheet or text editor. The first row gives the time for each margin (in kyr) and the left column is the number for the spatial
domains that was created in step #1. The shear stress values are given in kPa. It is probably best to print off a map that shows the locations
of the shear stress domains. I have included the figure of the shear stress domains used in NAICE in the base directory.

5) Running "run.sh" will automatically create and calculate all of the ice sheet reconstructions. Provided the binaries are in the right place
and you have GMT and NETCDF tools installed, it should work without needing any modification. It calculates three models - first with modern
topography, second with one iteration of GIA added to topography (ehgk - corresponding to a 120 km thick lithosphere, 
upper mantle of 4x10^20 Pa s, lower mantle 10^22 Pa s), and a third with a second iteration of GIA. The calculated GIA is stored
in the folder "def_mod", which I have included since I cannot distribute the program that I used to calculate it (calsea).

6) The finished output will be put into the folder "imodels". This is a text file that is used for calsea, but it might not be
the most convenient for other analysis. If you just want a series of long/lat/ice_thickness values, you can run the script in the "extract_ice"
directory to do this. You have to specify which file you want to extract from. There is also an "extract_def" program that also
will extract the paleotopography (minus ice thickness). Sum up the resulting files to get paleotopography.

7) Running the raw script in serial is very time consuming, it is suggested that if you have multiple cores to make use of them
and run several instances of the main script. In should be sufficient to run the script with GNU parallel (which you probably have
to install manually, since it is not included in most distros by default). Just use "run_parallel.sh". You can go into the script
and edit the amount of processors allowed to be used.

8) The margin files are stored in the folder "margins". In it, you will find a bunch of kml files that contain the margins. I exported
these from ARCGIS, so the perl script included should be able to extract everything. I didn't really document my original ARCGIS files
very well, and cannot guarantee that the kml files correspond to margin model #20, but I assume it should be correct. If you want to 
manipulate this, you can use Google Earth or import the kml files into QGIS and export them into txt files (it is up to you to create
the scripts that do that). The outline files in the directories are simply csv files with longitude,latitude,z (though z is zero). If
requested, I can try to dig up the Dyke et al 2003 margins, but it might be just as quick to export them yourself.
