This vignette shows the creation of a perturbed parameter ensemble design for JULES. It uses a maximin latin hypercube design to create a design of factors, which multiply the standard parameters for JULES. Individual PFTS are all multiplied by the same factor.
On running the code, a folder is created for the configuration file, the latin hypercube, the standard parameters, and allpft standard parameters (these will just be 1s at the moment.)
source('default_jules_parameter_perturbations.R')
# Easiest way to generate a design of the right size is to have a "fac" which takes
# the names from the parameter list, and then multiplies everything by 0.5 or 2
tf <- 'l_vg_soil'
# we don't want anything that is TRUE/FALSE to be in fac
fac.init <- names(paramlist)
not_tf.ix <- which(names(paramlist)!=tf)
paramlist.trunc <-paramlist[not_tf.ix]
fac <- names(paramlist.trunc)
maxfac <-lapply(paramlist.trunc,function(x) x$max[which.max(x$max)] / x$standard[which.max(x$max)])
minfac <- lapply(paramlist.trunc,function(x) x$min[which.max(x$max)] / x$standard[which.max(x$max)])
# create a directory for the configuration files
confdir <- 'conf_files_example'
dir.create(confdir)
#> Warning in dir.create(confdir): 'conf_files_example' already exists
# This is the function that writes the configuration files.
write_jules_design(paramlist, n = 100,
fac = fac, minfac = minfac, maxfac = maxfac,
tf = tf,
fnprefix = paste0(confdir,'/param-perturb-P'),
lhsfn = paste0(confdir,'/lhs_example.txt'),
stanfn = paste0(confdir,'/stanparms_example.txt'),
allstanfn = paste0(confdir,'/allstanparms_example.txt'),
rn = 12,
startnum = 0)
Print the minumum and maximum factors for perturbing the input parameters.
print(cbind(minfac, maxfac))
#> minfac maxfac
#> alpha_io 0.5 2
#> a_wl_io 0.5 2
#> bio_hum_cn 0.5 2
#> b_wl_io 0.6 2
#> dcatch_dlai_io 0.5 2
#> dqcrit_io 0.5 2
#> dz0v_dh_io 0 3.2
#> f0_io 0.7428571 1.110857
#> fd_io 0.5 2
#> g_area_io 0.5 2
#> g_root_io 0 3.333333
#> g_wood_io 0 2.5
#> gs_nvg_io 0.5 2
#> hw_sw_io 0 2
#> kaps_roth 0.5 2
#> knl_io 0.5 2.5
#> lai_max_io 0.5 1.428571
#> lai_min_io 0.33 3
#> lma_io 0.5 2
#> n_inorg_turnover 0 10
#> nmass_io 0.5 2
#> nr_io 0.5 2
#> retran_l_io 0 2
#> retran_r_io 0 5
#> r_grow_io 0.5 2
#> rootd_ft_io 0 2.666667
#> sigl_io 0.5 2
#> sorp 0 2
#> tleaf_of_io 0.9 1.1
#> tlow_io 0.9 1.1
#> tupp_io 0.6944444 1.138889
# Checking section
lapply(paramlist, function(x) length(x$standard))
#> $alpha_io
#> [1] 13
#>
#> $a_wl_io
#> [1] 13
#>
#> $bio_hum_cn
#> [1] 1
#>
#> $b_wl_io
#> [1] 13
#>
#> $dcatch_dlai_io
#> [1] 13
#>
#> $dqcrit_io
#> [1] 13
#>
#> $dz0v_dh_io
#> [1] 13
#>
#> $f0_io
#> [1] 13
#>
#> $fd_io
#> [1] 13
#>
#> $g_area_io
#> [1] 13
#>
#> $g_root_io
#> [1] 13
#>
#> $g_wood_io
#> [1] 13
#>
#> $gs_nvg_io
#> [1] 14
#>
#> $hw_sw_io
#> [1] 13
#>
#> $kaps_roth
#> [1] 4
#>
#> $knl_io
#> [1] 13
#>
#> $lai_max_io
#> [1] 13
#>
#> $lai_min_io
#> [1] 13
#>
#> $lma_io
#> [1] 13
#>
#> $l_vg_soil
#> [1] 1
#>
#> $n_inorg_turnover
#> [1] 1
#>
#> $nmass_io
#> [1] 13
#>
#> $nr_io
#> [1] 13
#>
#> $retran_l_io
#> [1] 13
#>
#> $retran_r_io
#> [1] 13
#>
#> $r_grow_io
#> [1] 13
#>
#> $rootd_ft_io
#> [1] 13
#>
#> $sigl_io
#> [1] 13
#>
#> $sorp
#> [1] 1
#>
#> $tleaf_of_io
#> [1] 13
#>
#> $tlow_io
#> [1] 13
#>
#> $tupp_io
#> [1] 13
lapply(paramlist, function(x) length(x$standard)==length(x$min) & length(x$standard)==length(x$max))
#> $alpha_io
#> [1] TRUE
#>
#> $a_wl_io
#> [1] TRUE
#>
#> $bio_hum_cn
#> [1] TRUE
#>
#> $b_wl_io
#> [1] TRUE
#>
#> $dcatch_dlai_io
#> [1] TRUE
#>
#> $dqcrit_io
#> [1] TRUE
#>
#> $dz0v_dh_io
#> [1] TRUE
#>
#> $f0_io
#> [1] TRUE
#>
#> $fd_io
#> [1] TRUE
#>
#> $g_area_io
#> [1] TRUE
#>
#> $g_root_io
#> [1] TRUE
#>
#> $g_wood_io
#> [1] TRUE
#>
#> $gs_nvg_io
#> [1] TRUE
#>
#> $hw_sw_io
#> [1] TRUE
#>
#> $kaps_roth
#> [1] TRUE
#>
#> $knl_io
#> [1] TRUE
#>
#> $lai_max_io
#> [1] TRUE
#>
#> $lai_min_io
#> [1] TRUE
#>
#> $lma_io
#> [1] TRUE
#>
#> $l_vg_soil
#> [1] TRUE
#>
#> $n_inorg_turnover
#> [1] TRUE
#>
#> $nmass_io
#> [1] TRUE
#>
#> $nr_io
#> [1] TRUE
#>
#> $retran_l_io
#> [1] TRUE
#>
#> $retran_r_io
#> [1] TRUE
#>
#> $r_grow_io
#> [1] TRUE
#>
#> $rootd_ft_io
#> [1] TRUE
#>
#> $sigl_io
#> [1] TRUE
#>
#> $sorp
#> [1] TRUE
#>
#> $tleaf_of_io
#> [1] TRUE
#>
#> $tlow_io
#> [1] TRUE
#>
#> $tupp_io
#> [1] TRUE