Closed bobilong closed 2 years ago
Dear @bobilong,
please provide a worked example or I can't really help you out I'm afraid.
K
Dear @khufkens ,
Thanks for your help, and I try to run the source code by line, and I found that the parameter k is too large in the function {F_req <- w exp(k C_tot)}, the result is infinite. And I change the upper of the initial value of k to 1, but it failed. The value of F_req is still infinite.
The demo.rds is our data which had already flatten by function "pr_flatten".
Sorry to disturb you again! demo.zip
Hi @bobilong,
If this is the full extent of your data than the problem is that you don't have enough data to inform the Unified Model.
This is a model with 9 parameters, for 23 observations (years) this is just too many. At best you'll overfit the model making it poorly constrained for anything but the range of data you have provided (scaling poorly both temporally as spatially).
The more paramteres you have, the more data you need. As a minimum you probably need 10x more data.
Cheers, K
Hi @khufkens , I run the model with all data, but the values of some sites are still 9999, and I found the reason is that the parameter k should be negatative according to the Chuine 2000. I think the temperature of that sites is too warm, so that chilling requirement is not met. To select the cold sites may be a good choice.Thanks for your help again! And I have aonother suggestion about this package, the function pr_fm_csv is to format the data with users' own sites, it could download enviroment facotrs from PEP725 with longitude and latitude, but it can't format the users' own data such as attach png formatUserData.zip . I think add this function to format users' data is better, because some data is not public.
And I rewrite your source code according my data, hope this is helpful to you! Happy new year!
Thanks @bobilong I pasted the code below as it is easier to see for everyone.
################# format_data ###################
format_data <- function(data){
datalist <- list()
for(sitename in unique(data$site))
{
d1 <- data[data$site == sitename,]
d2 <- d1[d1$site ==site,c('tmin','tmean','tmax','rain','vpd','daylight','year','doy')]
#wide to long
d3 <- reshape2::melt(d2,id.vars=c('year','doy'),variable.name = 'var',value.name = 'value')
#long to wide according to year
d4 <- reshape2::dcast(d3,doy+var~year)
#format matrix
Tmini <- as.matrix(subset(d4,d4$var=='tmin',select = -c(doy,var)))
Tmaxi <- as.matrix(subset(d4,d4$var=='tmax',select = -c(doy,var)))
Ti <- as.matrix(subset(d4,d4$var=='tmean',select = -c(doy,var)))
Pi <- as.matrix(subset(d4,d4$var=='rain',select = -c(doy,var)))
VPDi <- as.matrix(subset(d4,d4$var=='vpd',select = -c(doy,var)))
Li <- as.matrix(subset(d4,d4$var=='daylight',select = -c(doy,var)))
# recreate the validation data structure (new format)
# but with concatted data
data1 <- list("site" = sitename,
"location" = c(d1$lat[1], d1$lon[1]),
"doy" = unique(d1$trans_doy),
"transition_dates" = unique(d1[, c('year', 'sos')])$sos,
"year" = unique(d2$year),
"Ti" = Ti,
"Tmini" = Tmini,
"Tmaxi" = Tmaxi,
"Li" = Li,
"Pi" = Pi,
"VPDi" = VPDi)
# return the list
datalist[[sitename]] <- data1
}
return(datalist)
}
When I using my own data to calculate SOS date by phenor, the format of my data is same as phenocam_DB, i found the results of model 'UN' is 9999; but other models such as 'TT' or 'TTs' is perfectly running. And i try to use your own code 'phenocam_DB' to run the model 'UN' but failed, so could you please help me? Thank you very much!