Pages (Desktop)

Pages (Mobile)

Showing posts with label temperature. Show all posts
Showing posts with label temperature. Show all posts

RasterStacks and raster::plot

Following on from the previous guide looking at WorldClim data, in this guide I take a look at using RasterStacks to import WorldClim datasets. In the previous guide, we used RasterLayers to import the data, so what is the difference? A RasterStack is a collection of RasterLayers bundled together, or stacked into one object. If you're only dealing with a few RasterLayers, then a RasterStack might not be necessary. However, when the number of RasterLayers increase, it can be easier to work with RasterStacks.

For example, if you wanted to look at minimum, maximum, and mean temperature data, along with precipitation data from WorldClim, using RasterLayers would require you to create 48 separate objects. Using a RasterStack, you could instead create 4 objects containing all the data for each variable.

This guide will also take a look at some of the additional options you have when plotting RasterStacks and other raster objects. Did you know that when you plot a raster object in R using plot(), it actually invokes the raster::plot function, while standard objects (e.g. scatterplots) would invoke graphics::plot? The previous guide suggested you might want to plot a figure which includes separate plots for each month of the year, or you might want a minimum and maximum temperature plot? I'll show you how you can do this easily using RasterStacks and raster::plot.


Extracting data and making climate maps using WorldClim datasets

In this guide, i'll show you another way in which you can get climate data, by using WorldClim global climate datasets. This guide will take you through all the steps for downloading, opening, extracting, and plotting the data using R.

I'll show you how you can make some good looking climate maps using WorldClim data, for anywhere in the world. And, the guide will also look at some of the differences between the WorldClim datasets and CRU datasets (we looked at this in earlier guides), and why you might choose to use one or the other.


Working with extracted CRU climate data

In my previous guide, I showed you how to download and extract precipitation and temperature climate data from CRU datasets. Now that you have the raw data - i'll guide you through some of the ways in which you can work with, and manipulate this data.

From grouping your sample sites, to calculating annual data or seasonal data, to defining a climate period and then calculating changes to conditions since this period to observe climate change trends. I'll also show you how to plot the data to create climate graphs for your sites.


Getting Climate Data

Have you ever needed weather information or climate data for a project you are working on, such as a dissertation or thesis? Depending on which part of the world you need data for, sometimes it can prove very difficult to obtain good reliable climate datasets. While some agencies make weather station data freely accessible e.g. NOAA, others may restrict access. You might also want to look at climate data on large or global scales, where obtaining data from individual agencies can become more complex.

Luckily, there are several global climate datasets available, which have done all the hard work of collating and processing the climate data into an easily accessible and consistent format.

In part one of this guide, I will show you how to obtain climate data from the Climate Research Unit (CRU) and extract only the data you need for your project using R. In part two of this guide (coming soon!), I will show you how you can manipulate this data, while part three will show you how to extract climate data from WorldClim datasets.