Learn R Programming

cruts (version 1.1)

cruts2raster: cruts2raster function

Description

A function to convert Climatic Research Unit Time-Series in NetCDF format to raster format.

Usage

cruts2raster(
  ncfile,
  timeRange = NULL,
  poly = NULL,
  offset = "1900-01-01",
  type = "stack"
)

Arguments

ncfile

character string giving name and location of the CRUTS time series NetCDF file (if the file you downloaded is zipped, then you will need to extract it)

timeRange

vector of length 2 giving the start and end dates in the first and second place. Dates are converted using the function ymd, please refer to the help for this funciton for details on appropriate formats.

poly

an optional SpatialPolygonsDataFrame on which to crop the raster to

offset

time offset for CRU TS data

type

can be either 'brick' or 'stack' (thde default), this argument specifies what sort of raster object to return.

Value

a raster stack or brick containing the raw data

Details

Data can be obtained from http://catalogue.ceda.ac.uk/uuid/ac4ecbd554d0dd52a9b575d9666dc42d

Examples

Run this code
# NOT RUN {
crutsimport(ncfile="my_cruts_file.nc",timeRange=c("2000-01-01","2001-01-01"))
# }

Run the code above in your browser using DataLab