Learn R Programming

agroclim (version 0.1.0)

tempDayprob: First day in the year where P(tmax>threshold) >= probs

Description

Calculates the first day in the year where the probability of temperature over a threshold is higher than a predefined threshold.

Usage

tempDayprob(mx, dates, iniday = "01-01", endday = "09-01",
  type = "doy", thres = 35, prob = 0.1)

Arguments

mx

vector of daily (usually maximum) temperature series.

dates

vector of dates corresponding with daily temprature series

iniday

first day of the year ("dd-mm-YYYY") when frost occurrence will be considered.

endday

last day of the year ("dd-mm-YYYY") when frost occurrence will be considered.

type

type of output. It can be "doy" for day of the year (julian day) or "date" for data format ("dd-mm").

thres

temperature threshold considered to trigger frost occurrence (0 by default).

prob

numeric. Threshold indicating the probability (0.10 by default)

Value

A numeric vector with annual values is returned.

Details

The function is able to span over years. If the argument "enddate" is a date earlier than "inidate", the considered period will cover from "inidate" to the end of the year and from the beginning of the next year to "enddate".#' @return depending on argument type, the output will be a numeric vector of julian days (type = "doy") or a vector of characters with dates (type = "date").

Examples

Run this code
# NOT RUN {
tempDayprob(mx = daily_tmax, 
  dates = seq.Date(as.Date('1981-01-01'), 
                             as.Date('2010-12-31'), by ='day'), 
  iniday = '01-01', 
  endday = '09-01', 
  type = 'date',
  prob = 0.10)


# }

Run the code above in your browser using DataLab