cropresamplerain: Crop rainfall, convert to daily and resample to desired...

Description Usage Arguments Details Value

View source: R/precipitation.R

Description

Crop rainfall, convert to daily and resample to desired extent and resolution

Usage

1
cropresamplerain(file, r, Trace = TRUE)

Arguments

file

the name of the .nc file which the data are to be read from. If it does not contain an absolute path, the file name is relative to the current working directory, getwd(). Tilde-expansion is performed where supported.

r

an object of type raster of elevations. The returned spatialarray has the same resolution and extent as r.

Trace

optional logical indicating whether to create and plot a raster of every 100th entry to enable progress to be tracked.

Details

This function crops and resamples the rainfall data in file to the extent of r. It also performs elevation adjustments by applying a thin-plate spline model with elevation as a covariate to calculate the expected total rainfall and number of zero rainfall days. The resampled data is then adjusted accordingly. The 3600 values for each grid cell location are then spline interpolated to give daily values. Currently, the UKCP18 nc files contain errors in both the times and the defined coordinate reference system. These are corrected in the function, but users are advised to check their data.

Value

An object of class spatialarray containing the following components:

arraydata

A three-dimensional array of daily rainfall values

times

An object of class POSIXlt of times arraydata

crs

An object of class crs indicating the coordinate reference system associated with arraydata

extent

An object of class extent indicating the geographic extent covered by arraydata

units

Units of arraydata

description

Description of arraydata


ilyamaclean/UKCP18adjust documentation built on Nov. 4, 2019, 2:08 p.m.