Calculating bioclim variables in GRASS GIS

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.

For ArcInfo there is an aml script available on the WorldClim site. However, I do most of my GIS work in GRASS GIS in Linux so I decided to write a script for GRASS. 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 62) and the names of the variables (Tmax, Tmin and Prec on line 63-65). The script will create a new mapset (you’ll need to give a name on line 61) 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.

Update: there is also the R package dismo that lets you calculate the bioclimate data. Note that this will be done in R, so very large grids may pose a problem.

7 thoughts on “Calculating bioclim variables in GRASS GIS

  1. Pingback: Importing WorldClim climate .bil datalayers in GRASS GIS « YAWN

  2. Pingback: Extract values from multiple rasters | Ecostudies

  3. Pingback: Using DIVA-GIS to create bioclim data layers | Ecostudies

  4. pvanb

    I got a question about the naming of the maps (input maps presumably). You have to define the names in the script itself. As explained in the post, the scripts 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 62 of the script) and the names of the variables (Tmax, Tmin and Prec on line 63-65)). The script will create a new mapset (you’ll need to give a name on line 61). The 19 bioclim variables will have a fixed name (of course, you can change that in the script to).

    1. Yes, happy to have that addon. One should be aware that it uses 4 fixed quarters rather than ‘moving window’ quarters (i.e., 12 quarters) as is more commonly done (e.g., the wordclim bioclim data is based on the latter). It is clearly stated in the help file and the authors outline their reasons in the help file. Yet, I am still not convinced this is a good idea in many cases as it does implicitly assume that seasonality (length, start and end point) is not too different from location to location. This certainly does not hold true for many regions. Perhaps it is an idea to do a kind of sensitivity analysis to see how much the resulting layers differ between the two methods.

Leave a comment