Open dylanbeaudette opened 2 years ago
Hi David, your package would be very useful for characterize environments in the southern hemisphere. I think it is a great work. In the south we usually get climate information from NASA. Below you will find the code to get Tmin data form Balcarce (my place in Argentina) linked to the function FFD. If you run the code you will note that the FFD that yields is far from being accurate. The first frost in Balcarce takes place at the end of april and the last frost occurs early during november. I you fix the function, we can also obtain thermometer measured data from a weather station (INTA Balcarce) with more than 40 years of data to validate Nasa power.
I Don't know if that is the way you need the code (protocode), Im just a crop physiologist starting with R. Anyway, let me know if it is ok, or if you need different information.
Thanks a lot
Anibal
pacman::p_load(tidyverse, googlesheets4,ggridges, lubridate,sharpshootR, soilDB, plyr)
dates <- seq.Date(lubridate::dmy("1-1-2000"), lubridate::dmy("31-12-2021"), by = "1 day")
df <- nasapower::get_power(
community = "AG",
lonlat = c(-58.3,-37.35) ,
pars= c("ALLSKY_SFC_SW_DWN", "T2M_MAX","T2M_MIN","T2M","PRECTOTCORR" ),
dates = c(min(dates), max(dates)),
temporal_api = "DAILY"
)
ffd <- df %>%
mutate(datetime = YYYYMMDD, value=T2M_MIN) %>% mutate(datetime = as.Date(datetime))
x<-select(ffd,datetime,value)
x$year <- as.integer(format(x$datetime, "%Y"))
x<-select(x,datetime,year,value)
x.ffd <- FFD(x, returnDailyPr = TRUE, frostTemp=3)#,endSpringDOY=350,startFallDOY=80 )
par(mar=c(4,3.5,2,1))
FFDplot(x.ffd, 'NASA at (-58.55,-37.58)')
Excellent, thank you for the example code. I'll work on this next week--curious to see how the underlying algorithm can be shifted in time.
Major TODO items:
ddply
->lapply
hemisphere
argument for toggling N/S seasonal logic and defaults