Package 'cruts'

Title: Interface to Climatic Research Unit Time-Series Version 3.21 Data
Description: Functions for reading in and manipulating CRU TS3.21: Climatic Research Unit (CRU) Time-Series (TS) Version 3.21 data.
Authors: Benjamin M. Taylor Additional contributions Bikash Parida Jacob Davies
Maintainer: Benjamin M. Taylor <[email protected]>
License: GPL-3
Version: 1.1
Built: 2025-02-18 04:41:24 UTC
Source: https://github.com/cran/cruts

Help Index


cruts

Description

Read data from CRU TS3.21: Climatic Research Unit (CRU) Time-Series (TS) Version 3.21 of High Resolution Gridded Data of Month-by-month http://catalogue.ceda.ac.uk/uuid/ac4ecbd554d0dd52a9b575d9666dc42d

Usage

cruts

Format

An object of class logical of length 1.

Details

Package: cruts
Title: Interface to Climatic Research Unit Time-Series Version 3.21 Data
Version: 1.1
Author: Benjamin M. Taylor Additional contributions Bikash Parida Jacob Davies
Maintainer: Benjamin M. Taylor <[email protected]>
Description: Functions for reading in and manipulating CRU TS3.21: Climatic Research Unit (CRU) Time-Series (TS) Version 3.21 data.
Depends: R (>= 3.2.1)
License: GPL-3
Imports: sp, raster, stringr, lubridate, ncdf4
RoxygenNote: 7.0.2
Encoding: UTF-8
NeedsCompilation: no
Packaged: 2020-03-05 11:13:46 UTC; taylorb1
Date/Publication: 2020-03-05 12:10:02 UTC
Config/pak/sysreqs: libgdal-dev gdal-bin libgeos-dev libicu-dev libnetcdf-dev libproj-dev libsqlite3-dev
Repository: https://bentaylor1.r-universe.dev
RemoteUrl: https://github.com/cran/cruts
RemoteRef: HEAD
RemoteSha: 105ef336305a9cfc2c52d34325228871fe851200

Index of help topics:

cruts-package           cruts
cruts2poly              cruts2poly function
cruts2raster            cruts2raster function
extractNetCDF           extractNetCDF function
getAnomaly              getAnomaly function

sectionDependencies The package cruts depends upon some other important contributions to CRAN in order to operate; their uses here are indicated:

sp, raster, stringr, lubridate, ncdf.

sectionCitation X

references X

Author(s)

Benjamin Taylor, Department of Medicine, Lancaster University


cruts2poly function

Description

A function to convert Climatic Research Unit Time-Series in NetCDF format to polygonal format, averaging over each region in question.

Usage

cruts2poly(
  ncfile,
  poly,
  timeRange = NULL,
  offset = "1900-01-01",
  na.rm = FALSE
)

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)

poly

a SpatialPolygonsDataFrame on which to average the variable in question

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.

offset

time offset for CRU TS data

na.rm

logical, whether to ignore NA's in averaging, default is FALSE (to be consistent with other R functions in other packages), but option TRUE should probably be used on most occasions

Details

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

Value

a polygon with the averaged climate variable

Examples

## Not run: crutsimport(ncfile="my_cruts_file.nc",timeRange=c("2000-01-01","2001-01-01"))

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.

Details

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

Value

a raster stack or brick containing the raw data

Examples

## Not run: crutsimport(ncfile="my_cruts_file.nc",timeRange=c("2000-01-01","2001-01-01"))

extractNetCDF function

Description

A function to extract data from CRU TS NetCDF files. A wrapper function for get.var.ncdf.

Usage

extractNetCDF(nc, start = NULL, count = NULL)

Arguments

nc

an object inheriting class ncdf

start

the start index. A vector of indices indicating where to start reading the passed values (beginning at 1). The length of this vector must equal the number of dimensions the variable has. If not specified, reading starts at the beginning of the file (1,1,1,...).

count

A vector of integers indicating the count of values to read along each dimension. The length of this vector must equal the number of dimensions the variable has. If not specified and the variable does NOT have an unlimited dimension, the entire variable is read. As a special case, the value '-1' indicates that all entries along that dimension should be read. By default this extracts data for the first time point.

Value

an array or matrix with the requested data

Examples

## Not run: extractNetCDF(dat=dat)
## Not run: extractNetCDF(dat=dat,start=c(1,1,1,1),count=c(1,2,3,1))
## Not run: extractNetCDF(dat=dat,start=c(1,1,1,1),count=c(-1,1,1,1))

getAnomaly function

Description

A function to extract anomalies from the Climatic Research Unit Time-Series dataset

Usage

getAnomaly(
  ncfile,
  poly = NULL,
  timeRange = NULL,
  offset = "1900-01-01",
  na.rm = FALSE
)

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)

poly

an optional SpatialPolygonsDataFrame on which to compute the average anomalies if NULL (the default) a raster brick will be returned

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.

offset

time offset for CRU TS data

na.rm

logical, whether to ignore NA's in averaging, default is FALSE (to be consistent with other R functions in other packages), but option TRUE should probably be used on most occasions

Details

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

Value

a raster or polygon with the raw or spatially averaged anomalies