Lessons and recommendations for modellers
Back to Lev's Home page
Lessons and recommendations for modellers
Model builders
- Design your models for flexibility and ease of use.
- Develop your models incrementally.
- Analysize and document the model sensitivity
to each new component or modified parameterization.
- Write out the key algorithms.
- Document your source code. And make good use of blank lines to compartimentalize the logic/algorithms
- Write a publication quality "Methods" or "Model description" while you're developing
the code. It's easier than coming back to it later, and it helps to catch algorithmic problems
- Use clearly descriptive variable names, the less frequent the use the longer the name
- All parameters should have their units explicitly indicated in the code
- Use F90 (or C++), implicit none, explicit intents, and modules (not common blocks)
- Order arguments consistently, eg: inputs, outputs, control flags
- Add an integer "interFaceCheck" variable (of set value) at the end of subroutine calls when the call list is long or might otherwise be in danger of dimension mismatch
- For datafiles of variable dimension/size, add an "iendOfFileCheck" integer at the file end to ensure file/model match on size
- Be generous with internal input consistency/range checking
- Use existing software libraries whenever possible
- Design your own standard data formats for IO (or consider using standards such as netcdf)
- Design and implement strong model tests such as mass/flux conservation, sensitivity to time-step and grid resolution,...
- Add a model self-test option (eg via a preprocessor flag) to code that will be subject to upgrades
- Test array index ranges with compiler flags
- Check all compiler warning messages
- Plot key fields
- Maintain your own debugging log: how bugs were detected, and how to avoid them in the future
Model based analyses
- Consider ensemble-based analyses. There are too many papers published
that are based on model analyses with no rational error bars and many hidden
parameters.
- Before carrying out sensitivity analyses, put careful
thought into the choice of parameter ranges
- Write out all variable parameters to an ID file for each model run
- Build scripts for automated output analysis
- Save lots of output especially at the beginning. You can always dump data
later. And some of the most interesting results (and subtlest bugs) show up in the least suspected
fields.
- Plot results. Make movies. Get a visual sense of the model dynamics.
Things Earth Systems modellers need to know: online sources or books
Open-source (or at least free) software recommendations
I'm picky about reasonable learning curves, logical syntax, and simple scripts. These
packages are my favourites:
1D (timeseries,..) plots: gnuplot
scriptable, logical syntax
2D area map graphics and netcdf access/regridding...: Ferret
Ferret has a short learning curve and is script based (with
optional GUI interface for those so inclined). It is also backed
by a very helpful user/developer community
matrix/numerical analysis: Octave
Octave is an open-source partial clone of Matlab
data management/scripting: Python
Python is much more numerically oriented than Perl and with a more logical syntax
vector graphics: xfig
xfig is easy to use and can import many types of graphic files
GIS: GRASS
Powerful, scriptable, relatively easy learning curve, diverse set of toolboxes
Statistical Computing: R
Similar to the proprietary S language and environment but open-sourced and
with loads of tool-boxes.
general scripting: awk
awk, csh, sed, join, cut are all easy to use and powerful tools for managing
large datasets, automating data processing,...
Artificial Neural Networks
Netlab
is a freely available Neural Toolbox for Matlab (that
unfortunately doesn't work on Octave). It's biggest plus is
the associated
text:
Netlab: Algorithms for Pattern Recognition. All the
algorithms are developed in detail in the textbook and for me
this was a great learning aid. Phil
Goodman's Nevprop
is the easiest package that I've found to use. It is a good
starting point for someone who wants to get quick results even
though it is limited to standard feedforward multilayer
perceptron networks. For Bayesian neural networks and Markov
chain sampling I recommend Radford
Neal's
software for flexible Bayesian modelling which is being
used in our calibration project.
Back to Lev's Home page