Created
August 18, 2022 16:25
-
-
Save dlebauer/28fc131f532c77ff267ed68e196a4ae8 to your computer and use it in GitHub Desktop.
meta analysis and ensemble examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(PEcAn.DB) | |
# given PFT name but no model name??? | |
# | |
# if select count(*) from pfts where name= <PFT name> > 1 then | |
# select modeltype_id from pfts where name = <PFT name> | |
# if > 1 modeltype_id | |
# select name from modeltypes where id = modeltype_id | |
# return these model names as messsage asking which one user wants | |
# user can call again with model name | |
# we will figure this out later | |
# if select count(*) from pfts where name= <PFT name> == 1 then | |
# select modeltype_id from pfts where name = <PFT name> | |
# select name from modeltypes where id = modeltype_id | |
## Run Meta Analysis | |
# pft | |
pfts <- list(pft = list(name = "SetariaWT", outdir = "/tmp/RtmpGGtzIt")) | |
db <- list(driver = "PostgreSQL", | |
user = 'bety', | |
password = 'bety', | |
host = 'postgres') | |
a <- get.trait.data(pfts = pfts, | |
modeltype = 'BIOCRO', dbfiles = '', | |
forceupdate = TRUE, | |
database = db | |
) | |
b <- run.meta.analysis(pfts = a, iterations = 5000, database = db, dbfiles = '') | |
## Get Ensemble Samples | |
# pft | |
# ensemble size | |
# method | |
pft.samples <- file.path(a$pft$outdir, "post.distns.Rdata") | |
method <- 'lhc' | |
ensemble.size <- 10 | |
get.ensemble.samples(ensemble.size = ensemble.size, # usually want 100s or more | |
pft.samples = pft.samples, | |
env.samples = data.frame(row.names = 1:ensemble.size), | |
method = method) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment