# Generate hourly temperatures from the first season from
# the example dataset Tudela_DW
library(magrittr)
library(dplyr)
library(lubridate)
Tudela_Sel <- Tudela_DW %>% filter(Tudela_DW$Year<=2002)
Tudela_HT <- hourly_temps(Tudela_Sel,42.13132)
# Calculate chill as chill portions, starting on DOY 305
Chill <- chill_portions(Tudela_HT,305)
# Calculate forcing heat as growing degree hours (GDH) with the linear model,
# using base temperature 4.7 C and no upper thresholds
GDH <- GDH_linear(Tudela_HT,4.7,999,999)
# Combine Chill and GDH values in a dataframe with a format compatible with
# the function phenology_sequential
Tudela_CH <- merge(Chill,GDH) %>%
select(Date, Year, Month, Day, DOY, Chill,GDH) %>%
arrange(Date) %>%
rename(GD=GDH)
# Obtain the predicted dates using the example dataset with the requirements
# indicated in the Bigtop_reqs example dataset and create a dataframe with a
# format compatible with the function spring_frost
Phenology_BT <- phenology_sequential(Tudela_CH, Bigtop_reqs, 305) %>%
select(Freq_Year,Freq_DOY) %>%
rename(Year=Freq_Year,Pheno_date=Freq_DOY) %>%
filter (Year==2002)
# Create a dataframe with daily minimum temperatures with the
# format required by spring_frost
Tmin_Tudela <- Tudela_Sel %>% filter(Year==2002) %>%
mutate(Date=make_date(Year,Month,Day), DOY=yday(Date)) %>%
select(Year, DOY, Tmin)
# Predict the number and accumulated damage of the spring frosts using the
# critical values contained in the example dataset Tcrits_peach and extract
# the dataframe with the total results for each year
Frost_BT <- spring_frost(Tmin_Tudela, Phenology_BT, Tcrits_peach, 181)
Frost_results <- as.data.frame(Frost_BT[['Damage_frosts']])
Run the code above in your browser using DataLab