Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates to FFD() #43

Open
4 tasks
dylanbeaudette opened this issue Feb 22, 2022 · 2 comments
Open
4 tasks

updates to FFD() #43

dylanbeaudette opened this issue Feb 22, 2022 · 2 comments

Comments

@dylanbeaudette
Copy link
Member

Major TODO items:

  • convert ddply -> lapply
  • better handling of leap-years
  • add hemisphere argument for toggling N/S seasonal logic and defaults
  • test for southern hemisphere calculations
@acerru
Copy link

acerru commented Feb 22, 2022

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

#packages

pacman::p_load(tidyverse, googlesheets4,ggridges, lubridate,sharpshootR, soilDB, plyr)

#define time interval

dates <- seq.Date(lubridate::dmy("1-1-2000"), lubridate::dmy("31-12-2021"), by = "1 day")

##get climate from nasa

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"
) 

##frost free period FFD (sharpshootR)

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 )

Probability 50,80,90

par(mar=c(4,3.5,2,1))
FFDplot(x.ffd, 'NASA at (-58.55,-37.58)')

@dylanbeaudette
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants