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

Define LAI as Input Value #71

Open
yjaguilara opened this issue May 21, 2024 · 1 comment
Open

Define LAI as Input Value #71

yjaguilara opened this issue May 21, 2024 · 1 comment

Comments

@yjaguilara
Copy link

I would like to be able to initially define LAI for each of the days I am going to analyze, in the same way that I defined SAI, densef, Age, height. However, the code I have found only gives me the option to calculate LAI with the available methods using make_seasLAI.
What function or variable input could I use to define specific LAI values for each of the days I will analyze?
Thanks in advance for your help.

@pschmidtwalter
Copy link
Owner

pschmidtwalter commented May 22, 2024

Do you also estimate LAI from a function and few parameters? We could implement it as a new lai-method into the package.

Otherwise, you can use the low-level function that calls the model kernel (see below), or adjust the run_LWFB90() function directly.

Let me know if that works for you.

Best regards,
Paul

library(LWFBrook90R)
library(data.table)

parms <- set_paramLWFB90()
opts <- set_optionsLWFB90()
soil <- cbind(slb1_soil, hydpar_wessolek_tab(slb1_soil$texture))

# create an input list without running the model
input <- run_LWFB90(options_b90 = opts, 
           param_b90 = parms,
           climate = slb1_meteo,
           soil = soil,
           run = F)


# prepare climate
climate = data.table(slb1_meteo)
climate[,`:=`(yr=year(dates), mo = month(dates), da = mday(dates), mesfl = 0)]
climate <- climate[between(dates, opts$startdate,opts$enddate),]

# put your lai series into standprop_daily data.frame 
input$standprop_daily 


# run model using low-level function (call copied and adjusted from run_LWFB90).  
simout <- with(input, 
               r_lwfbrook90(
                 siteparam = data.frame(as.integer(format(options_b90$startdate, "%Y")),
                                        as.integer(format(options_b90$startdate, "%j")),
                                        param_b90$coords_y, param_b90$snowini, param_b90$gwatini,
                                        options_b90$prec_interval),
                 climveg = cbind(climate[, c("yr", "mo", "da","globrad","tmax","tmin",
                                             "vappres","windspeed","prec","mesfl")],
                                 standprop_daily[, c("densef", "height", "lai", "sai", "age")]),
                 precdat = NULL,
                 param = param_to_rlwfbrook90(param_b90, options_b90$imodel),
                 pdur = param_b90$pdur,
                 soil_materials = param_b90$soil_materials,
                 soil_nodes = param_b90$soil_nodes[,c("layer","midpoint", "thick", "mat", "psiini", "rootden")],
                 output_log = F,
                 chk_input = F
                 )
)

str(simout)

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