Extras

In addition to the native matlab geostatistical commands, mGstat contains interfaces to GSTAT (GSTAT from Matlab), S-GeMS (S-GeMS - The Stanford Geostatistical Modeling Software), VISIM (VISIM - Direct and Gaussian sequential simulation), SNESIM (SNESIM - Single Normal Equation SIMulation), and nfd (“FAST/nfd functions”).

As of version 0.9, mGstat includes compiled windows binaries for, GSTAT, VISIM and SNESIM. Source and compiled windows version of S-GeMS is available online (see below).

For unix systems, GSTAT, VISIM, SNESIM, and nfd must be compiled from scratch. The windows exe-file for %sgems; can optionally be run on Linux/OSX using WINE. mGstat includes source code for VISIM and SNESIM. Source code for GSTAT, S-GeMS, and nfd can be downloaded online (see below). Note that all programs but nfd is released under open source licences.

GSTAT

As of version 0.8, mGstat comes with a gstat.exe pre-compiled for Windows, and thus no further installation should be necessary.

As of version 1.0, mGstat comes with a pre-compiled binary for Intel Mac gstat_mac_g3, and thus no further installation should be necessary.

From the GSTAT website (http://www.gstat.org/) both source and binary packages can be downloaded.

The GSTAT PDF manual is a very useful source of information to have access to while using GSTAT.

Making GSTAT available for mGstat

mGstat use the m-file gstat_binary to locate the GSTAT binary file. gstat_binary searches the system path to find a binary executable called gstat, and chooses the first it encounters. In the mGstat/bin directory is also scanned.

Simply running from within Matlab should return the full path to the GSTAT binary as

>> gstat_binary

ans =

/usr/local/bin/gstat

If the gstat binary file is not in the system path, or if you have difficulties using the default automatic localization, gstat_binary.m can be manually edited to point to a specific location. Simple replace

gstat = '';

with

gstat='/usr/local/bin/gstat';    

VISIM

As of version 0.8, mGstat comes with a visim.exe pre-compiled for Windows. Therefore no further installation should be necessary on Windows.

As of version 0.9, the source code for VISIM is part of the mGstat code. The source code is located in mGstat/visim/visim/src

To compile visim ;

cd mGstat/visim/visim/src/gslib
# EDIT Makefile to point to your fortran 77 or fortran 90 compiler
make
cd mGstat/visim/visim/src
# EDIT Makefile to point to your fortran 77 or fortran 90 compiler
# EDIT visim.inc to change/set the maximum array sized
make

this should create a binary 'visim' or 'visim.exe' (windows). Copy this file to

cp mGstat/visim/visim/src/visim mGstat/bin/.

A detailed manual for VISIM can be obtained from Inverse modeling and geostatistics project.

SNESIM

As of version 0.9, mGstat comes with a snesim.exe pre-compiled for Windows. Therefore no further installation should be necessary on Windows.

As of version 0.9, the source code for VISIM is part of the mGstat code. The source code is located in mGstat/visim/visim/src

S-GeMS

S-GeMS source, and compiled windows exe files, can be downloaded from http://sgems.sourceforge.net/. S-GeMS version 2.1 is supported by mGstat (http://downloads.sourceforge.net/sgems/sgems-2.1_installer.exe).

On windows systems the S-GeMS binary is assumed to be located in c:\Program Files\SGeMS\sgems.exe. If it is located on another location, it should be manually set in “sgems”.

On Linux, mGstat can call both a natively compiled S-GeMS binary and the Windows compiled S-GeMS binary using WINE

Setting the system environment variable for S-GeMS.

In order to call S-GeMS from within Matlab the environment variable GSTLAPPLI must be set and point to the installation directory for S-GeMS.

Using linux and the bash shell use:

export GSTLAPPLI=/path/to/sgems_dir

Using windows Vista, right click on 'My Computer'; select properties; sleect Advanced System Setting; Choose 'environment variables';

Using windows XP, right click on 'My Computer'; select 'Properties'; select the 'Advanced' tab; click 'Environment Variables';

Click 'New' to add a system variable called GSTLAPPLI and set to the value /path/to/sgems_dir

Compiling S-GeMS for Linux.

A guide for compiling S-GeMS from source code on Ubuntu Linux is available here: http://imgp.imm.dtu.dk/compile_sgems.php.

Running S-GeMS using WINE.

If you fail to compile S-GeMS natively, you can run the windows binary EXE through using operating systems supported by WINE. WINE allow running windows applications on Linux, BSD, Solaris and Mac OS X. SGeMS seems to work fine using WINE

Start by installing wine, which is available as a package for most Linux systems (for Debian/Ubuntu use):

sudo apt-get install wine

Then install the S-GeMS windows executable (download from http://downloads.sourceforge.net/sgems/sgems-2.1_installer.exe.) using WINE:

wine sgems-2.1_installer.exe

This should create desktop icon for S-GeMS (running through wine).

To use S-GeMS through WINE edit sgems.m to make make sure the use_wine_on_unix set to '1': or set a system environmental variable as:

setenv('USE_WINE_ON_UNIX','1')