cadconditions: Calculates whether conditions are right for cold air drainage

Description Usage Arguments Details Value Examples

View source: R/cadtools.R

Description

cadconditions determines whether wind speed, humidity and cloud cover are such that cold air drainage is likely to occur

Usage

1
2
3
cadconditions(h, tc, n, p = 100346.13, wind, startjul, lat, long,
  starttime = 0, hourint = 1, windthresh = 4.5, emthresh = 0.5,
  merid = round(long/15, 0) * 15, dst = 0, con = TRUE)

Arguments

h

a vector of hourly specific humidities (kg kg-1 ).

tc

a single numeric value, raster object, two-dimensional array or matrix of temperatures (ºC).

n

a vector of hourly fractional cloud cover values (range 0 - 1).

p

an optional vector of hourly atmospheric pressure values (Pa).

wind

a vector of wind speed values at one metre above the ground (m s-1 )

startjul

julian day of first observation as returned by julday()

lat

latitude of the location for which cold air drainage conditions are required (decimal degrees, -ve south of equator).

long

longitude of the location for which cold air drainage conditions are required (decimal degrees, -ve west of Greenwich meridian).

starttime

the hour of the first observation (decimal, 0-23).

hourint

the interval (in hours) between successive observations

windthresh

an optional threshold value of wind speed below which cold air conditions can occur (m s-1 )

emthresh

an optional threshold value of emissivity below which cold air conditions can occur (range 0 - 1)

merid

an optional numeric value representing the longitude (decimal degrees) of the local time zone meridian (0 for GMT). Default is round(long / 15, 0) * 15

dst

an optional numeric value representing the time difference from the timezone meridian (hours, e.g. +1 for BST if merid = 0).

con

an optional logical value indicating whether or not to allow cold air drainage conditions to occur only if conditions are right for three or more consecutive hours. Ignored if hourint != 1.

Details

cadconditions uses a time series of wind and emissivity data to determine whether cold air drainage conditions are likely to occur and returns a binary vector of the same length as em and wind indicating whether conditions occur (1) or not (0). They are assumed to occur at night or within three hours of dawn only and when both em and wind are below the values specified by windthresh and emthresh. If no start time is specified it is assumed that first index of em and wind occurs at midnight on the date specified by startjul. If no hourint is provided, the time interval between indices of em and wind are assumed to be hourly. If con is TRUE and hourint is 1 (the default), cold air drainage conditions are assumed to persist only when conditions are right for three consecutive hours or more. The first index of the output, for which prior conditions cannot be assessed is set to 1 if conditions are right, irrespective of prior conditions. The second index is set to one only if conditions are right in both that hour and the preceding hour. If con is FALSE or hourint != 1 prior conditions are ignored.

Value

a vector of binary values indicating whether cold air drainage conditions occur (1) or not (0)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# ===============================================
# Mean daily climate for Lizard, Cornwall in 2010
# ===============================================
h <- apply(huss, 3, mean, na.rm = TRUE)
p <- apply(pres, 3, mean, na.rm = TRUE)
tmin <- apply((tas - dtr), 3, mean, na.rm = TRUE)[2:364]
tmax <- apply((tas + dtr), 3, mean, na.rm = TRUE)[2:364]
# =====================================
# hourly climate 2nd Jan to 30 Dec 2010
# =====================================
h <- spline(h, n = 8737)$y[13:8724]
p <- spline(p, n = 8737)$y[13:8724]
n <- apply(cfc[,,13:8724], 3, mean)
rdni <- apply(dnirad[,,13:8724], 3, mean)
rdif <- apply(difrad[,,13:8724], 3, mean)
jd <- julday(2010, 2, 1)
jd <- c(jd:(jd+362))
tc <- hourlytemp(jd, h, n, p, rdni, rdif, tmin, tmax, 50.05, -5.19)
ws10m <- spline(wind2010$wind10m, n = 8755)$y[25:8736]
ws1m <- windheight(ws10m, 10, 1)
# =================================================================
# Calculate whether cold air drainage, persists and plot proportion
# =================================================================
startjul <- julday(2010,1,2)
hist(cadconditions(h, tc, n, p, ws1m, startjul, 50.05, -5.19),
     main = "", xlab = "Cold air drainage conditions (1 = Y)")

ilyamaclean/microclima documentation built on Dec. 14, 2018, 3:10 p.m.