mst: mst: Mean summer temperature

Description Usage Arguments Details Value Examples

Description

mst calculates the mean temperature during summer, accounting for differences in the timing of the summer period for the northern and southern hemispheres.

Usage

1
mst(temp, year, startday = 152, endday = 243, r)

Arguments

temp

a three dimensional array of temperature values (deg C).

year

calendar year.

startday

assumed day of year of start of summer in northen hemisphere in non-leap year.

endday

assumed end of summer. Defaults are 1st June to 31st Aug.

r

a raster 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 added. Startday and endday should be for northern hemisphere, and are calculated for southern hemisphere within the function.

Value

a matrix of mean summer temperature values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
temp <- array(10 * sin(c(0:1459) / (pi * 150)) + rnorm(1460), 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)
mst(temp, 2010, startday = 152, endday = 243, r)

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