tsp: tsp: Total summer precipitation

Description Usage Arguments Details Value Examples

Description

tsp calculates total precipitation during the summer season

Usage

1
tsp(prec, year, startday = 152, endday = 243, r)

Arguments

prec

a three dimensional array of precipitation values.

startday

assumed day of year of start of summer in northen hemisphere in non-leap year. Default is day 152 (1st June).

endday

assumed day of year of start of summer in northen hemisphere in non-leap year. Default is day 243 (31st August).

r

a raster object of same extent as temp coded as 1 for northern hemisphere and 0 for southern hemisphere.

Details

Seasons are flipped in the southern hemisphere i.e. 1st June (day 152) = day 152+365/2+0.5 = 334 = 1st Dec. In leap years, 1 day is added.

Value

a matrix of total summer precipitation values for northern and southern hemisphere.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
prec <- array(10 * sin(c(0:1459) * (pi / -1400)) + runif(1460, 0, 10) +10, dim=c(73,144,1460))
m <- matrix(1, 73, 144)
r <- raster(m, crs="+init=epsg:4326")
extent(r) <- c(-1.25, 358.75, -91.25, 91.25)
enorth<-extent(-1.25,358.75,0,91.25)
esouth<-extent(-1.25,358.75,-91.25,0)
rn<-crop(r,enorth) * 0 + 1
rs<-crop(r,esouth) * 0
r<-mosaic(rn,rs,fun=mean)
tsp(prec, 2010, startday = 152, endday = 243, r)

ilyamaclean/climvars documentation built on June 19, 2019, 2:22 p.m.