Import Worldclim data into GRASS

Importing wordlclim layers (http://www.worldclim.org/) into GRASS should be straitforward using r.in.gdal. However the data have to be unzipped and  a line has to be added to the headers.

Assuming that the file to be imported is mean temperature at 2.5m resolution

This line unzips your file

unzip tmean_2-5m_bil.zip

Make sure the region is set.

g.region n=89N s=89S e=180E w=180W res=00:02:30

This line fixes the problem with the missing header

for i in $(seq 1 12); do echo “PIXELTYPE SIGNEDINT” >>tmean$i.hdr; done

This line will then import the data into GRASS: Notice that you need to change the name from tmean to the appropriate name in two places (for example input=tmin$i.bil,output=tmin$i)

for i in $(seq 1 12); do r.in.gdal -o input=tmean$i.bil output=tmean$i; done

Finally remove the unzipped files

rm tmean*.bil
rm tmean*.hdr

Click here to download a PDF showing screenshots of the steps.

Click here for a flash presentation.

One thought on “Import Worldclim data into GRASS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s