-
Notifications
You must be signed in to change notification settings - Fork 3
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
Interannual variability #15
Comments
There are two very different analyses in the papers you sent : the effects of climate change and the effects of interannual variability. The scope of the Agmip Climate change scenarios (Asseng et al, predicting to 2100) is beyond the scope of this paper. I do have the met data, we just need an author The analyses in the paper by Schlenker is basically a regression of yield on climate variables (and location). We can similarly calculate the relationship between yield and climate (e.g. the slope of temperature and precipitation responses). e.g. lm(yield ~ temperature + precipitation + random(site|year)) I think this will be more meaningful that running the model under 5 global climate models x 4 CO2 emissions scenarios, especially because the global climate models used to generate these analyses are explicitly intended to predict mean fields and decadal to century scale trends rather than inter-annual variability.
I'll take a closer look, but to a first appoximation,
To select the years, I will put the following at line 23 of the if(met.uncertainty = TRUE){
met <- load.cfmet(met.nc, lat = lat, lon = lon, start.date = "1979-01-01",
end.date = "2010-12-31")
year.sample <- met[,list(year = sample(unique(year), size = 15))]
met <- met[year %in% year.sample$year]
} Then to loop over this, say 500 times, add the following to starting at line 42 for(point in 1:nrow(latlon)){ add for (i in 1:500){
for(point in 1:nrow(latlon)){
set.seed(i)
....
## change def. of point.outdir
point.outdir <- file.path(outdir, i, paste0(lat, 'x', lon)
## compute cumulative probability as fn of yield
ecdf(yield)
## find a distribution that fits simulated yield
lapply(c('gamma', 'lnorm', 'weibull', 'norm') function(x) fitdist(yield, x)
quantile(yield, c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)
## probability density: ## or best fit distribution / parameters from #2
dnorm(quantile(yield, c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9), mu_hat, sigma_hat) |
Would be great if you or Hao wanted to do the above proposed computations / changes. |
Stochastic weather generators can be used to generate artificial weather. This is one such paper: http://onlinelibrary.wiley.com/doi/10.1029/2006WR005364/abstract |
David, can you instruct us on how we can load the met data in R? I saw it in run.biocro function that you filtered met data based on sampling from different years. |
Hao - how familiar are you with R? Start with: debugonce(run.biocro) Then run the code in regional_pecan_workflow.Rmd It will go through this: met.nc <- nc_open(settings$run$inputs$met$path)
## equals
# met.nc <- nc_open("/home/a-m/dlebauer/ebimodeling/met/narr/threehourly/illinois.nc")
lat <- 40
lon <- -88
start.date <- '1979-01-01'
end.date <- '1990-01-01' Then Rstudio will launch you into a debugger environment to walk through the function. At this point I find it more useful to begin editing the source code file in the In either case, you will end up inside met <- load.cfmet(met.nc, lat = lat, lon = lon, start.date = start.date, end.date = end.date)
met.hr <- cfmet.downscale.time(cfmet = met, output.dt = 1)
biocro.met <- cf2biocro(met.hr) Which is where the code to randomly sample years above would be added. If the In this case, I don't think it is necessary to 'prepare' new met files, just to enable BioCro to be run on a random sample of years. By adding a few lines to the @vnbisn the code you sent is indeed an exceptional weather generator. Just what we need - it generates hourly estimates for many variables including humidity, direct and diffuse solar radiation, PAR. However ... a bit more than I can take on at this time unless there is a logical flaw in sampling from the historical record to estimate climate uncertainty. However, it looks like a great method for handling the climate model forecasts that we have. http://www-personal.umich.edu/~ivanov/HYDROWIT/Models.html source: http://www-personal.umich.edu/~ivanov/HYDROWIT/Models_files/AWE_GEN_COMPLETE.zip |
Thanks David! When I started with debugonce(run.biocro) and then ran the code in regional_pecan_workflow.Rmd, it did not bring me to a debugging environment, but directly submit jobs to ROGER. I figured out that the code reads the met data on ROGER because when I print out settings$run$inputs$met$path in R, it returns me /gpfs_scratch/haohu3//illinois.nc, it that part correct? |
yep. then you can start from met.nc <- nc_open("/gpfs_scratch/haohu3//illinois.nc") On Thu, Sep 3, 2015 at 11:50 PM, Hao Hu [email protected] wrote:
|
I apologize. I confused the workflow script with the script that reads the configuration file, opens the weather + soil, and then runs BioCro On Roger, you can start in this file:
and start stepping through the steps. the For example, see /home/dlebauer/pecan_remote/mxg_calibration/Orr_Research/run/17203/job.sh You can just run that script from anywhere. But you can also look in and see how it is calling biocro: This line has three arguments: the r script, the input directory, and the output directory /home/dlebauer/dev/pecan/models/biocro/inst//pointbiocro.Rscript /home/dlebauer/
pecan_remote/mxg_calibration/Orr_Research/run/17203 /home/dlebauer/pecan_remote/
mxg_calibration/Orr_Research/out/17203 So ... you need to open
then debugonce(run.biocro) |
from Tao:
I think it would be very interesting to quantify the inter-annual climate changes on perennial crop production and bioenergy supply chain development.
The key issues we need to work on further would be:
Please let me know if you have any comments and any help on the model runs and data analysis. I would like to focus on this study for the following month.
references:
Wolfram Schlenker| 2006 Inter-annual Weather Variation and Crop Yields
S. Asseng et al. 2013 Uncertainty in simulating wheat yields under climate change
The text was updated successfully, but these errors were encountered: