Nuts and Bolts: Extracting global climate and soil data in R

There are a few publicly available data sets that are useful for looking at the abiotic environments of specific locations.

WorldClim

A public dataset of global climate variables. From WorldClim.org.

Climate data is available in the form of geoTIFFS from WorldClim.org. Various scales of projections are available, down to ~1 km2. Also, current, past, and future projections are available. Altitude and 19 bioclimatic variables are included (dealing with temperature or precipitation), such as average temperature range, and precipitation of warmest quarter.

There is also a data set on global soil types at GeoNetwork. They offer shapefiles in ESRI, Erdas, and IDSRI formats. I have not used these file types much, but if I come up with an R script I will update this post.

Here is an R script I wrote to extract information from a geoTIFF file from WorldClim for specific locations given GPS coordinates, using the R package raster, and to create a data table of the climate variables for those locations. I originally wrote it all out longways (which was super annoying!), but now I’ve written it as a bunch of for loops. But nobody is in love with for loops, so if you have a more elegant solution, please drop some knowledge bombs on me! (To clean up the resulting data table see this post).

Edit: Turns out there is a function in the raster package which may do the same thing: getData(). You should probably check that out.

Advertisements

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