Currently, this repository contains settings files for developing the globalbiocro.Rscript
in the PEcAn.BIOCRO package.
There is a version of the script in vignettes/globalbiocro.Rscript
, and branches for different machines.
These inputs were prepared for the MsTMIP runs, and we will need to comply with any restrictions on their use at time of publication.
Files are on ebi-forecast in /home/share/data/
, on biocluster in /home/groups/ebimodeling/
met/cruncep/all.nc
soil/hwsd.nc
There is a branch for use on biocluster and one for use on ebi-forecast.
(do this on a slave node qsub -I
)
ncrename -v surface_pressure,air_pressure foo.nc
sh cd /home/groups/ebimodeling/met/cruncep/ time ncks -d lon,-135.0,-67.0 -d lat,25.0,48.0 out/all_uncompressed.nc us_uncompressed.nc
sh
Convert date to index
library(lubridate)
ymd("2013-01-01") - ymd("1700-01-01")
## Time difference of 114321 days
ymd("2014-01-01") - ymd("1700-01-01")
## Time difference of 114686 days
time ncea -F -d time,114321,114686 us_uncompressed.nc us_2013.nc
time ncea -F -d time,114321,114686 illinois.nc illinois_2013.nc
cd /home/groups/ebimodeling/met/narr/threehourly
time ncks -d lon,-91.6,-87.4 -d lat,37.0,42.75 out/all.nc illinois.nc
time ncks -d lon,-88.8,-87.7 -d lat,39.8,40.5 out/all.nc champaign.nc
rsync -routi *.nc ebi-forecast.igb.illinois.edu:.pecan/dbfiles/met/narr/
set.seed(0)
download.file("https://www.betydb.org/temp_models/miscanthus_yield_grid.csv", method = 'wget', destfile = 'mxg.csv', extra = "--no-check-certificate")
library(data.table)
##
## Attaching package: 'data.table'
##
## The following objects are masked from 'package:lubridate':
##
## hour, mday, month, quarter, wday, week, yday, year
mxg <- fread('mxg.csv', skip = 1)
mxg[ , `:=` (lcl = round(yield * 0.25, 2),
ucl = round(yield * 0.5, 2),
median = round(yield * 0.75, 2),
yield = NULL)]
## lat lon lcl ucl median
## 1: 38.96153 -123.55790 1.98 3.96 5.94
## 2: 39.24150 -123.63930 4.92 9.84 14.75
## 3: 39.52163 -123.72150 4.94 9.89 14.83
## 4: 39.80193 -123.80450 3.06 6.12 9.17
## 5: 40.36298 -123.97290 3.75 7.50 11.25
## ---
## 7623: 45.49031 -67.63921 3.33 6.66 9.99
## 7624: 44.58933 -67.90132 3.56 7.12 10.68
## 7625: 44.84104 -67.69658 3.67 7.34 11.01
## 7626: 45.09244 -67.48988 3.77 7.55 11.32
## 7627: 44.94524 -67.13498 2.37 4.74 7.11
mxg_il <- mxg[lon < -87.4 & lon > -91.6 & lat < 42.75 & lat > 37]
write.csv(mxg_il, 'data/mxg_il_example.csv', row.names = FALSE)
download.file("https://www.betydb.org/temp_models/miscanthus_yield_county.csv", method = 'wget', destfile = "mxg_co.csv", extra = "--no-check-certificate")
library(data.table)
mxg <- fread('mxg_co.csv', skip = 1)
mxg_il <- mxg[STATE=="IL",
list(state = STATE,
county = County_NAME,
county_fips = County_FIPS,
yield = miscanthus_yield)]
yield <- list()
for(year in 1990:2005){
i <- year-1989
## miscanthus change over time
t <- c(0.3, 0.5, 0.8, 1, 1.2, 1.1, 1, 0.95, 0.9, 0.85, 0.8, 0.77, 0.74, 0.7, 0.65)[i]
## random error for each county
e <- runif(nrow(mxg_il), -0.1, 0.1)
yield[[i]] <- mxg_il[,list(state, county, county_fips,
year = year,
yield = yield * (t + e))]
}
m <- rbindlist(yield)
m[ ,`:=` (lcl = 0.8*yield,
median = yield,
ucl = 1.3 * yield,
yield = NULL)]
## state county county_fips year lcl median ucl
## 1: IL Adams 17001 1990 8.536290 10.670362 13.871471
## 2: IL Alexander 17003 1990 4.064225 5.080282 6.604366
## 3: IL Bond 17005 1990 6.299761 7.874702 10.237112
## 4: IL Boone 17007 1990 3.826545 4.783181 6.218136
## 5: IL Brown 17009 1990 8.898735 11.123419 14.460444
## ---
## 1628: IL Whiteside 17195 2005 NA NA NA
## 1629: IL Will 17197 2005 NA NA NA
## 1630: IL Williamson 17199 2005 NA NA NA
## 1631: IL Winnebago 17201 2005 NA NA NA
## 1632: IL Woodford 17203 2005 NA NA NA
write.csv(m, 'data/mxg_il_co_example.csv', row.names = FALSE)