http://pvanb.wordpress.com/2009/12/22/calculating-bioclim-variables-in-grass-gis/


Calculating bioclim variables in GRASS GIS

December 22, 2009 by pvanb

I am currently working on the modeling of the distribution of different
vegetation types and associate species in eastern Africa. In absence of more
detailed climate data for the region, a great source of global climatic data
is the WorldClim website. Besides the usual monthly temperature and rainfall
data, it provides bioclimatic variables which are derived from these monthly
temperature and rainfall values in order to generate more biologically
meaningful variables. However, it only does this for the current conditions
(interpolations of observed data, representative of 1950-2000) but not yet (?)
for the future conditions (downscaled data from global climate model (GCM)
output, IPPC 3rd assessment). Thus, I had to calculate them myself, which I
did using GRASS GIS and R.

There used to be a link to an aml script which could be used to calculate
these variables in ArcGIS, but that link seems to have gone. Besides I do most
of my GIS work in GRASS GIS in Linux. I am not a programmer and if I have to
do some scripting I normally would use R. However, because GRASS runs directly
from the command line I though it might actually be easier to write a batch
script. Wrong idea as it turned out, primarily because I know next to nothing
about the command line syntax. Still, I managed at the end to come up with
something which can be used to calculate the bioclimatic data from GRASS GIS.
If you are interested, you can download the script from here. To run the
script you’ll need to make it executable:

> cd path_to_folder_where_you_saved_the_script
> chmod a+x r.bioclim

I might rewrite it later to open a GUI when run, but for now you’ll have to
change a few lines in the script before running it. It assumes you have a
mapset with monthly rainfall, minimum and maximum temperatures. You will need
to give the name of the mapset (Inmap on line 57) and the names of the
variables (Tmax, Tmin and Prec on line 58-60). The script will create a new
mapset (you’ll need to give a name on line 56) and will generate 19 bioclim
variables (see script for more details) in that mapset. Open GRASS GIS and run
the following on the command line:

> cd path_to_folder_where_you_have_the_script
> ./r_bioclim

I don’t know if the same script runs under GRASS on Windows, but you probably
will need to make some adaptations. And to end with the usual disclaimer, if
you decide to try it out, you’ll run in entirely on your own risk. 
