R/data.loadTemperature.R

Defines functions data.loadTemperature

Documented in data.loadTemperature

data.loadTemperature <- function(year, temperature.year, 
				temperature.previous.year, 
				from.previous.year.doy, length, 
				position, scale.factor=0.1){

	previous.year.length <- ifelse(util.isLeapYear(year-1),366,365)
	temperature.vec <- vector(mode="numeric", length=length)
	
	previous.year.count <- length(from.previous.year.doy:previous.year.length)
	temperature.vec[1:previous.year.count] <- 
		temperature.previous.year[from.previous.year.doy:previous.year.length,position]
	temperature.vec[(previous.year.count+1):length(temperature.vec)] <- 
		temperature.year[1:length((previous.year.count+1):length(temperature.vec)),position]

	return(temperature.vec * scale.factor)
}

Try the phenmod package in your browser

Any scripts or data that you put into this service are public.

phenmod documentation built on April 14, 2022, 5:08 p.m.