Global Warming - GCM Model-E Source Code

The NASA Goddard Institute for Space Studies (GISS), at Columbia University in New York City, provides the source code for GCM Model-E. While I was excited to find something this useful, I was disappointed to discover that the model's source is a combination of Fortran, Perl, and Unix shell scripts.

modelE1.tar.gz | Fortran | Perl Scripts | Shell Scripts | Make Scripts | Script Files


The first step was to download and decompress modelE1.tar.gz (the source code for GCM Model-E). I used 7-Zip to unzip and unpack the file in two steps ... except that the aux directory can not be created. (On Windows systems, aux is a reserved word applied to a device port.) As a result, 20 files in the aux directory would not decompress. My solution was to manually decompress the files into a directory named aux1.

I unpacked the download into


The main program itself is written in Fortran, one of the older (and seldom used) programming languages. Therefore, I downloaded the free gnu gfortran compiler.

This is just a short summary of why I dislike Fortran (there are books written on this).

The newer code

Model-E has both types of code ... apparently, some parts of the model are more than 20 years old (and very difficult to read).

Perl Scripts

Perl is a mostly Unix programming language. It is possible to run this on a Windows machine, but it requires downloading and installing the interpreter.

Perl also places the path to the interpreter on the first line of the source file ... therefore, every file will have to be modified.

Shell Scripts

On MS-DOS and Windows systems, small scripts are saved as *.bat files. On Unix systems, shell scripts serve the same purpose. Unfortunately, there are several shell script interpreters ... so you never know if a specific script will work until you try it. (Believe me, this is a real PITA.)

At any rate, Windows will not interpret shell scripts unless you can find and download the right interpreter.

In addition, the filenames will also require extensions and the code that calls the scripts will need the new filenames.

Make Scripts

Many programming languages provide their own script interpreter called make or some related variation.

This model comes with script files that are interpreted with the gnu gmake program. Unfortunately, this is not the make interpreter that comes with gnu fortran for Windows.

As a result, none of the provided make scripts will run under Windows.

Script Files

The perl scripts must be edited to run because the path to the interpreter is different on Unix and Windows systems.

Fortran is a batch language, originally run via decks of cards. (Yes, this is an old language.) Instead of using a configuration file, the models configuration information is provided via a rundeck. By convention, these decks are files ending with the extension R. Several default configurations are provided with the distribution. Among other things, these rundecks specify

Several programs use the same rundeck.

This model is run as a batch (unattended with no user display) process. There are numerous programs that get information from the command line. Several of the scripts write other scripts.

Linking files is a uniquely Unix function, though it can be accomplished via Windows shortcuts. However, a Windows link does not work with this program because the "real" name is xyz.lnk, not xyz expected by the program.

On Unix system, files are marked as executable by setting a flag (using chmod). When the filename is entered, Unix looks at the first line of the file to determine if it is an executable or if it should be processed by an interpreter. Since the full path to the interpreter is included, moving the code to another system frequently requires modifying the embedded path.

Under Windows, the filename extension determines how the program is executed (including what interpreter is used). Since the provided scripts don't have extensions (with 2 exceptions), major modifications would be needed even if appropriate interpreters could be found.

Because of these differences, there is no reason to attempt to uses any of the provided Unix scripts on Windows - a complete rewrite in a Windows scripting language (or perhaps Fortran) makes a lot more sense.

Author: Robert Clemenzi
URL: http:// / Global_Warming / Model_E / Source_Code.html