Skip to content

Instantly share code, notes, and snippets.

@ashiklom
Created May 15, 2017 15:45
Show Gist options
  • Save ashiklom/78e507dc54f825cc12a8e38d88e87613 to your computer and use it in GitHub Desktop.
Save ashiklom/78e507dc54f825cc12a8e38d88e87613 to your computer and use it in GitHub Desktop.
DALEC issue log
R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> #!/usr/bin/env Rscript
> #-------------------------------------------------------------------------------
> # Copyright (c) 2012 University of Illinois, NCSA.
> # All rights reserved. This program and the accompanying materials
> # are made available under the terms of the
> # University of Illinois/NCSA Open Source License
> # which accompanies this distribution, and is available at
> # http://opensource.ncsa.illinois.edu/license.html
> #-------------------------------------------------------------------------------
>
> # ----------------------------------------------------------------------
> # Load required libraries
> # ----------------------------------------------------------------------
> library(PEcAn.all)
Loading required package: PEcAn.DB
Loading required package: DBI
Loading required package: PEcAn.utils
Loading required package: XML
Loading required package: ggplot2
Loading required package: randtoolbox
Loading required package: rngWELL
This is randtoolbox. For overview, type 'help("randtoolbox")'.
Loading required package: abind
Loading required package: RCurl
Loading required package: bitops
Loading required package: PEcAn.settings
Loading required package: PEcAn.MA
Loading required package: lattice
Loading required package: MASS
Loading required package: PEcAn.uncertainty
Loading required package: PEcAn.priors
Loading required package: gridExtra
Loading required package: PEcAn.data.atmosphere
Loading required package: PEcAn.data.land
Loading required package: PEcAn.data.remote
Loading required package: PEcAn.assim.batch
Loading required package: ellipse
Loading required package: dplyr
Attaching package: 'dplyr'
The following object is masked from 'package:gridExtra':
combine
The following object is masked from 'package:MASS':
select
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: parallel
Loading required package: GPfit
Loading required package: IDPmisc
Loading required package: grid
Loading required package: rjags
Loading required package: coda
Linked to JAGS 4.2.0
Loaded modules: basemod,bugs
Loading required package: BayesianTools
Attaching package: 'PEcAn.assim.batch'
The following object is masked from 'package:BayesianTools':
correlationPlot
Loading required package: PEcAn.emulator
Loading required package: mvtnorm
Loading required package: MCMCpack
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2017 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0350646 and SES-0350613)
##
Loading required package: PEcAn.benchmark
> library(PEcAn.utils)
> library(RCurl)
>
> # make sure always to call status.end
> options(warn=1)
> options(error=quote({
+ status.end("ERROR")
+ kill.tunnel(settings)
+ if (!interactive()) {
+ q()
+ }
+ }))
>
> #options(warning.expression=status.end("ERROR"))
>
>
> # ----------------------------------------------------------------------
> # PEcAn Workflow
> # ----------------------------------------------------------------------
> # Open and read in settings file for PEcAn run.
> args <- commandArgs(trailingOnly = TRUE)
> if (is.na(args[1])){
+ settings <- PEcAn.settings::read.settings("pecan.xml")
+ } else {
+ settings.file = args[1]
+ settings <- PEcAn.settings::read.settings(settings.file)
+ }
2017-05-15 08:34:43 INFO [PEcAn.settings::read.settings] :
Loading inpufile= pecan.xml
>
> # Check for additional modules that will require adding settings
> if("benchmarking" %in% names(settings)){
+ library(PEcAn.benchmark)
+ settings <- papply(settings, read_settings_RR)
+ }
>
> # Update/fix/check settings. Will only run the first time it's called, unless force=TRUE
> settings <- PEcAn.settings::prepare.settings(settings, force=FALSE)
2017-05-15 08:34:43 INFO [fix.deprecated.settings] :
Fixing deprecated settings...
2017-05-15 08:34:43 INFO [update.settings] :
Fixing deprecated settings...
2017-05-15 08:34:43 INFO [check.settings] : Checking settings...
Loading required package: RPostgreSQL
2017-05-15 08:34:43 INFO [check.database] :
Successfully connected to database : bety bety localhost bety PostgreSQL
true
2017-05-15 08:34:43 DEBUG [check.database.settings] :
Writing all runs/configurations to database.
2017-05-15 08:34:43 WARN [check.bety.version] :
Last migration 20170118205944 is more recent than expected
20141009160121. This could result in PEcAn not working as expected.
2017-05-15 08:34:44 INFO [fn] :
No start date passed to ensemble - using the run date ( 2002 ).
2017-05-15 08:34:44 INFO [fn] :
No end date passed to ensemble - using the run date ( 2002 ).
2017-05-15 08:34:44 INFO [fn] :
Setting site name to Metolius-first young aged pine (US-Me5)
2017-05-15 08:34:44 INFO [fn] :
Setting site lat to 44.4372
2017-05-15 08:34:44 INFO [fn] :
Setting site lon to -121.567
2017-05-15 08:34:44 INFO [check.settings] :
Setting meta.analysis threshold to 1.2
2017-05-15 08:34:44 INFO [check.settings] :
Setting meta.analysis update to only update if no previous meta analysis
was found
2017-05-15 08:34:44 INFO [check.model.settings] :
Setting model type to DALEC
2017-05-15 08:34:44 INFO [check.model.settings] :
Setting model revision to
2017-05-15 08:34:44 INFO [check.model.settings] :
Option to delete raw model output not set or not logical. Will keep all
model output.
2017-05-15 08:34:44 INFO [check.model.settings] :
Setting model binary to /usr/local/bin/dalec_seqMH
2017-05-15 08:34:44 INFO [check.workflow.settings] :
output folder = /home/carya/output//PEcAn_99000000003
2017-05-15 08:34:44 INFO [check.settings] :
Storing pft evergreen in
/home/carya/output//PEcAn_99000000003/pft/evergreen
>
> # Write pecan.CHECKED.xml
> PEcAn.settings::write.settings(settings, outputfile = "pecan.CHECKED.xml")
[1] "/home/carya/output//PEcAn_99000000003/pecan.CHECKED.xml"
>
> # start from scratch if no continue is passed in
> statusFile <- file.path(settings$outdir, "STATUS")
> if (length(which(commandArgs() == "--continue")) == 0 && file.exists(statusFile)) {
+ file.remove(statusFile)
+ }
>
> # Do conversions
> settings <- do.conversions(settings)
>
>
> # Query the trait database for data and priors
> if (status.check("TRAIT") == 0){
+ status.start("TRAIT")
+ settings <- runModule.get.trait.data(settings)
+ PEcAn.settings::write.settings(settings, outputfile='pecan.TRAIT.xml')
+ status.end()
+ } else if (file.exists(file.path(settings$outdir, 'pecan.TRAIT.xml'))) {
+ settings <- PEcAn.settings::read.settings(file.path(settings$outdir, 'pecan.TRAIT.xml'))
+ }
[1] "---------------------------------------------------------"
[1] "leaf_turnover_rate"
[1] "Median leaf_turnover_rate : 0.426"
[1] "---------------------------------------------------------"
2017-05-15 08:34:45 INFO [FUN] :
Summary of Prior distributions for: evergreen
2017-05-15 08:34:45 INFO [FUN] :
distn parama paramb n
2017-05-15 08:34:45 INFO [FUN] :
root_turnover_rate unif 0.0000 10.0000 NA
2017-05-15 08:34:45 INFO [FUN] :
leaf_turnover_rate unif 0.0400 1.0000 NA
2017-05-15 08:34:45 INFO [FUN] :
SLA unif 3.0000 30.0000 NA
2017-05-15 08:34:45 INFO [FUN] :
autotrophic_respiration_fraction beta 8.4229 9.3356 0
2017-05-15 08:34:45 INFO [FUN] :
leaf_allocation_fraction beta 8.9103 18.9848 0
2017-05-15 08:34:45 INFO [FUN] :
litter_decomposition_to_SOM exp 157176.2000 0.0000 0
2017-05-15 08:34:45 INFO [FUN] :
litter_respiration_rate gamma 0.3265 3.9822 0
2017-05-15 08:34:45 INFO [FUN] :
wood_turnover_rate gamma 0.0782 0.1123 0
2017-05-15 08:34:45 INFO [FUN] :
som_respiration_rate exp 261565.0000 0.0000 0
2017-05-15 08:34:45 INFO [FUN] :
root_allocation_fraction beta 15.2563 19.7635 0
2017-05-15 08:34:45 INFO [FUN] :
number of observations per trait for evergreen
2017-05-15 08:34:45 INFO [FUN] :
4 observations of leaf_turnover_rate
>
>
> # Run the PEcAn meta.analysis
> if(!is.null(settings$meta.analysis)) {
+ if (status.check("META") == 0){
+ status.start("META")
+ runModule.run.meta.analysis(settings)
+ status.end()
+ }
+ }
2017-05-15 08:34:46 INFO [FUN] :
-------------------------------------------------------------------
2017-05-15 08:34:46 INFO [FUN] :
Running meta.analysis for PFT: evergreen
2017-05-15 08:34:46 INFO [FUN] :
-------------------------------------------------------------------
2017-05-15 08:34:46 INFO [check_consistent] :
OK! leaf_turnover_rate data and prior are consistent:
2017-05-15 08:34:46 INFO [check_consistent] :
leaf_turnover_rate P[X<x] = 0.397135416666667
Each meta-analysis will be run with:
3000 total iterations,
4 chains,
a burnin of 1500 samples,
,
thus the total number of samples will be 6000
################################################
------------------------------------------------
starting meta-analysis for:
leaf_turnover_rate
------------------------------------------------
NO ERROR STATS PROVIDED, DROPPING RANDOM EFFECTS
prior for leaf_turnover_rate
(using R parameterization):
unif(0.04, 1)
data max: 0.42125
data min: 0.42125
mean: 0.421
n: 1
stem plot of data points
no estimates of SD for leaf_turnover_rate
Read 28 items
Compiling model graph
Resolving undeclared variables
Allocating nodes
Graph information:
Observed stochastic nodes: 1
Unobserved stochastic nodes: 3
Total graph size: 19
Initializing model
Iterations = 1002:4000
Thinning interval = 2
Number of chains = 4
Sample size per chain = 1500
1. Empirical mean and standard deviation for each variable,
plus standard error of the mean:
Mean SD Naive SE Time-series SE
beta.o 0.4381 0.157 0.002027 0.002674
sd.y 1.0648 8.442 0.108982 0.110690
2. Quantiles for each variable:
2.5% 25% 50% 75% 97.5%
beta.o 0.11323 0.38318 0.4225 0.4712 0.8789
sd.y 0.01295 0.05325 0.1645 0.5531 5.5635
2017-05-15 08:34:47 INFO [check_consistent] :
OK! leaf_turnover_rate data and prior are consistent:
2017-05-15 08:34:47 INFO [check_consistent] :
leaf_turnover_rate P[X<x] = 0.398410400003477
2017-05-15 08:34:48 INFO [pecan.ma.summary] :
JAGS model converged for evergreen leaf_turnover_rate GD MPSRF = 1.001
>
> # Write model specific configs
> if (status.check("CONFIG") == 0){
+ status.start("CONFIG")
+ settings <- runModule.run.write.configs(settings)
+ PEcAn.settings::write.settings(settings, outputfile='pecan.CONFIGS.xml')
+ status.end()
+ } else if (file.exists(file.path(settings$outdir, 'pecan.CONFIGS.xml'))) {
+ settings <- PEcAn.settings::read.settings(file.path(settings$outdir, 'pecan.CONFIGS.xml'))
+ }
2017-05-15 08:34:49 WARN [dbfile.check] :
Multiple Valid Files found on host machine. Returning last updated
record
2017-05-15 08:34:49 INFO [get.parameter.samples] :
Selected PFT(s): evergreen
Warning in rm(prior.distns, post.distns, trait.mcmc) :
object 'prior.distns' not found
Warning in rm(prior.distns, post.distns, trait.mcmc) :
object 'post.distns' not found
Warning in rm(prior.distns, post.distns, trait.mcmc) :
object 'trait.mcmc' not found
2017-05-15 08:34:49 INFO [get.parameter.samples] :
PFT evergreen has MCMC samples for: leaf_turnover_rate
2017-05-15 08:34:49 INFO [get.parameter.samples] :
PFT evergreen will use prior distributions for: root_turnover_rate SLA
autotrophic_respiration_fraction leaf_allocation_fraction
litter_decomposition_to_SOM litter_respiration_rate wood_turnover_rate
som_respiration_rate root_allocation_fraction
2017-05-15 08:34:49 INFO [get.parameter.samples] :
using 5004 samples per trait
Loading required package: PEcAn.DALEC
2017-05-15 08:34:49 INFO [write.config.DALEC] :
t7 t5 SLA t2 t3 t1 t8 t6 t9 t4
[1] 99000000003
2017-05-15 08:34:49 INFO [run.write.configs] :
###### Finished writing model run config files #####
2017-05-15 08:34:49 INFO [run.write.configs] :
config files samples in /home/carya/output//PEcAn_99000000003/run
2017-05-15 08:34:49 INFO [run.write.configs] :
parameter values for runs in
/home/carya/output//PEcAn_99000000003/samples.RData
>
> if ((length(which(commandArgs() == "--advanced")) != 0) && (status.check("ADVANCED") == 0)) {
+ status.start("ADVANCED")
+ q();
+ }
>
> # Start ecosystem model runs
> if (status.check("MODEL") == 0) {
+ status.start("MODEL")
+ runModule.start.model.runs(settings)
+ status.end()
+ }
2017-05-15 08:34:49 INFO [start.model.runs] :
-------------------------------------------------------------------
2017-05-15 08:34:49 INFO [start.model.runs] :
Starting model runs DALEC
2017-05-15 08:34:49 INFO [start.model.runs] :
-------------------------------------------------------------------
|
| | 0%
|
|======================================================================| 100%
>
> # Get results of model runs
> if (status.check("OUTPUT") == 0) {
+ status.start("OUTPUT")
+ runModule.get.results(settings)
+ status.end()
+ }
2017-05-15 08:34:53 INFO [read.ensemble.output] :
reading ensemble output from run id: 99000000003
2017-05-15 08:34:53 INFO [read.output] :
Reading output for Years: 2002 - 2002 in directory:
/home/carya/output//PEcAn_99000000003/out/99000000003 including files
2002.nc
2017-05-15 08:34:54 INFO [read.output] :
NPP Mean: 1.93e-08 Median: 1.86e-08
>
> # Run ensemble analysis on model output.
> if ('ensemble' %in% names(settings) & status.check("ENSEMBLE") == 0) {
+ status.start("ENSEMBLE")
+ runModule.run.ensemble.analysis(settings, TRUE)
+ status.end()
+ }
[1] "----- Variable: NPP"
[1] "----- Running ensemble analysis for site: Metolius-first young aged pine (US-Me5)"
[1] "----- Done!"
[1] " "
[1] "-----------------------------------------------"
[1] " "
[1] " "
[1] "------ Generating ensemble time-series plot ------"
[1] "----- Variable: NPP"
[1] "----- Reading ensemble output ------"
[1] 9.9e+10
2017-05-15 08:34:54 INFO [read.output] :
Reading output for Years: 2002 - 2002 in directory:
/home/carya/output//PEcAn_99000000003/out/99000000003 including files
2002.nc
2017-05-15 08:34:55 INFO [read.output] :
NPP Mean: 1.93e-08 Median: 1.86e-08
>
> # Run sensitivity analysis and variance decomposition on model output
> if ('sensitivity.analysis' %in% names(settings) & status.check("SENSITIVITY") == 0) {
+ status.start("SENSITIVITY")
+ runModule.run.sensitivity.analysis(settings)
+ status.end()
+ }
>
> # Run parameter data assimilation
> if ('assim.batch' %in% names(settings)) {
+ if (status.check("PDA") == 0) {
+ status.start("PDA")
+ settings <- PEcAn.assim.batch::runModule.assim.batch(settings)
+ status.end()
+ }
+ }
>
> # Run state data assimilation
> if ('state.data.assimilation' %in% names(settings)) {
+ if (status.check("SDA") == 0) {
+ status.start("SDA")
+ settings <- sda.enfk(settings)
+ status.end()
+ }
+ }
>
> # Run benchmarking
> if("benchmarking" %in% names(settings)){
+ status.start("BENCHMARKING")
+ results <- papply(settings, function(x) calc_benchmark(x, bety))
+ status.end()
+ }
>
> # Pecan workflow complete
> if (status.check("FINISHED") == 0) {
+ status.start("FINISHED")
+ kill.tunnel(settings)
+ db.query(paste("UPDATE workflows SET finished_at=NOW() WHERE id=", settings$workflow$id, "AND finished_at IS NULL"), params=settings$database$bety)
+
+ # Send email if configured
+ if (!is.null(settings$email) && !is.null(settings$email$to) && (settings$email$to != "")) {
+ sendmail(settings$email$from, settings$email$to,
+ paste0("Workflow has finished executing at ", base::date()),
+ paste0("You can find the results on ", settings$email$url))
+ }
+ status.end()
+ }
>
> db.print.connections()
2017-05-15 08:34:55 INFO [db.print.connections] :
Created 11 connections and executed 87 queries
2017-05-15 08:34:55 INFO [db.print.connections] :
Created 11 connections and executed 87 queries
2017-05-15 08:34:55 DEBUG [db.print.connections] :
No open database connections.
> print("---------- PEcAn Workflow Complete ----------")
[1] "---------- PEcAn Workflow Complete ----------"
>
> proc.time()
user system elapsed
12.796 0.616 14.328
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment