Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jingxia/pecan
Browse files Browse the repository at this point in the history
  • Loading branch information
dlebauer committed Mar 8, 2013
2 parents 8b09eff + ebb99a2 commit 5616f1c
Show file tree
Hide file tree
Showing 14 changed files with 387 additions and 25 deletions.
44 changes: 44 additions & 0 deletions models/biocro/vignettes/workflow.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
BioCro PEcAn workflow
======================

```{r, echo=FALSE,warning=FALSE}
require(PEcAn.all)
```
### Load PEcAn settings file.

Open and read in settings file for PEcAn run.


```{r, echo=FALSE,warning=FALSE}
settings <- read.settings(system.file("pecan.biocro.xml",
package = "PEcAn.BIOCRO"))
model <- settings$model$name
```
### Run PEcAn workflow

```{r, echo=FALSE,warning=FALSE,cache=TRUE}
settings$pfts$pft$name <- "ebifarm.pavi"
get.trait.data() # Query the trait database for data and priors
run.meta.analysis() # Run the PEcAn meta.analysis
```

```{r, echo=FALSE,warning=FALSE,cache=TRUE}
run.write.configs(model) # Calls model specific write.configs e.g. write.config.ed.R
## load met data
start.model.runs(model) # Start ecosystem model runs
get.model.output(model) # Get results of model runs
#run.sensitivity.analysis() # Run sensitivity analysis and variance decomposition on model output
#run.ensemble.analysis() # Run ensemble analysis on model output.
# OPTIONAL: run.ensemble.analysis(plot.timeseries=TRUE) to get an esemble
# time-series output for the target variables set in the PEcAn.xml file
### PEcAn workflow run complete
print("---------- PEcAn Workflow Complete ----------")
#--------------------------------------------------------------------------------------------------#
```
9 changes: 6 additions & 3 deletions qaqc/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ Version: 1.0
Date: 2013-02-21
Author: David LeBauer
Maintainer: David LeBauer <[email protected]>
Description: PEcAn integration and model skill testing
Depends: plotrix
Description: PEcAn integration and model skill testing
Depends:
plotrix
License: FreeBSD + file LICENSE
Copyright: Authors
LazyLoad: yes
LazyData: FALSE
LazyData: FALSE
Collate:
''
1 change: 0 additions & 1 deletion qaqc/NAMESPACE
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
exportPattern("^[[:alpha:]]+")
8 changes: 8 additions & 0 deletions qaqc/R/compare ED2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
library(ncdf4)
library(PEcAn.utils)
ed2.2008 <- nc_open ('../output/PEcAn_9/out/9/2004.nc');
xx <- nc_open ('../output/PEcAn_1/out/1/2004.nc')
read.output(run.id=1, outdir='../output/PEcAn_1/out/1',
start.year=2004, end.year=2009,
variables="GPP",
model="SIPNET")
35 changes: 35 additions & 0 deletions qaqc/R/taylor.plot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#-------------------------------------------------------------------------------
# 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
#-------------------------------------------------------------------------------

##' plot taylor diagram for benchmark sites
##' @title Taylor Diagram
##' @param runid a numeric vector with the id(s) of one or more runs (folder in runs) to plot
<<<<<<< HEAD
new.taylor <- function(dataset,runid,siteid){
attach(dataset)
for(run in runid){
for (si in siteid){
if (run==runid[1]&&si==siteid[1]){
taylor.diagram(obs[site %in% si],get(paste("model",run,sep=""))[site %in% si],pos.cor=FALSE)
R <- cor(obs[site %in% si],get(paste("model",run,sep=""))[site %in% si],use="pairwise")
sd.f <- sd(get(paste("model",run,sep=""))[site %in% si])
lab=paste(paste("model",run,sep=""), paste("site",si,sep=""))
text(sd.f * R, sd.f * sin(acos(R)), labels=lab,pos=3)
}
else {
taylor.diagram(obs[site %in% si],get(paste("model",run,sep=""))[site %in% si],pos.cor=FALSE,add=TRUE)
R <- cor(obs[site %in% si],get(paste("model",run,sep=""))[site %in% si],use="pairwise")
sd.f <- sd(get(paste("model",run,sep=""))[site %in% si])
lab=paste(paste("model",run,sep=""), paste("site",si,sep=""))
text(sd.f * R, sd.f * sin(acos(R)), labels=lab,pos=3)
}
}
}

}
7 changes: 7 additions & 0 deletions qaqc/inst/extdata/data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"","site","date","obs","model1","model2"
"1",1,2001,8.75751883891639,14.4636635852943,14.8594772436841
"2",1,2001,5.570600225645,13.7817039636525,12.831613781413
"3",1,2002,12.2498618362862,14.7569321148247,12.532613479884
"4",2,2003,9.91013278196954,14.3464089021932,8.58774284830218
"5",2,2004,9.96761947380211,12.2236949500956,11.5655498346741
"6",3,2005,11.8876724213706,6.03194491240988,14.2538246805991
26 changes: 26 additions & 0 deletions qaqc/inst/extdata/extdata.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#-------------------------------------------------------------------------------
# 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
#-------------------------------------------------------------------------------

#--------------------------------------------------------------------------------------------------#
##'
##' generate benchmarking inputs table
##' @title Generate benchmarking inputs
##' @param runid the id of the run (folder in runs) to execute
set.seed(1)
<<<<<<< HEAD:qaqc/inst/extdata/extdata.R
testdata=data.frame(site=c(1,1,1,2,2,3),time=c(2001,2001,2002,2003,2004,2005),obs=rnorm(6,10,2),model1=rnorm(6,10,3)+2,model2=rnorm(6,11,3)+2)
write.csv(testdata, file="/home/carya/pecan/qaqc/inst/extdata/testdata.csv")

read.csv(system.file("extdata/testdata.csv", package = "PEcAn.qaqc"))
=======
data=data.frame(site=c(1,1,1,2,2,3),date=c(2001,2001,2002,2003,2004,2005),obs=rnorm(6,10,2),model1=rnorm(6,10,3)+2,model2=rnorm(6,11,3)+2)
write.csv(data, file="/home/carya/pecan/qaqc/inst/extdata/data.csv")

read.csv(system.file("extdata/data.csv", package = "PEcAn.qaqc"))
>>>>>>> 2e67e66597e65e855e75f651c1f13bae015c21af:qaqc/inst/extdata/extdata.R
25 changes: 25 additions & 0 deletions qaqc/inst/test/test.taylor.plot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#-------------------------------------------------------------------------------
# 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
#-------------------------------------------------------------------------------


library("plotrix")
<<<<<<< HEAD
set.seed(5)
testdata <- data.frame(site=c(1,1,1,2,2,3),
date=c(2001,2001,2002,2003,2004,2005),
obs=rnorm(6,10,2),model1=rnorm(6,10,3),model2=rnorm(6,10,3))
=======
set.seed(1)
testdata <- data.frame(site=c(1,1,1,2,2,3),
date=c(2001,2001,2002,2003,2004,2005),
obs=rnorm(6,10,2),model1=rnorm(6,10,3)+2,model2=rnorm(6,11,3)+2)
>>>>>>> 2e67e66597e65e855e75f651c1f13bae015c21af

taylor.diagram(testdata$obs,testdata$model1,pos.cor=FALSE)
taylor.diagram(testdata$obs,model=testdata$model2,add=TRUE,col="blue")
21 changes: 21 additions & 0 deletions qaqc/vignettes/compare ED2.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Title
============

looking at how read.output works
------

```{r, echo=FALSE, message=FALSE}
library(ncdf4)
library(PEcAn.utils)
ed2.2008 <- nc_open ('../output/PEcAn_9/out/9/2004.nc');
xx <- nc_open ('../output/PEcAn_13/out/13/2004.nc')
read.output(run.id=1, outdir='../output/PEcAn_1/out/1',
start.year=2004, end.year=2009,
variables="GPP",
model="SIPNET")
```


```{r fig.width=7, fig.height=6}
```
167 changes: 167 additions & 0 deletions qaqc/vignettes/compare ED2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<title></title>

<style type="text/css">
body, td {
font-family: sans-serif;
background-color: white;
font-size: 12px;
margin: 8px;
}

tt, code, pre {
font-family: 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', Consolas, Monaco, monospace;
}

h1 {
font-size:2.2em;
}

h2 {
font-size:1.8em;
}

h3 {
font-size:1.4em;
}

h4 {
font-size:1.0em;
}

h5 {
font-size:0.9em;
}

h6 {
font-size:0.8em;
}

a:visited {
color: rgb(50%, 0%, 50%);
}

pre {
margin-top: 0;
max-width: 95%;
border: 1px solid #ccc;
white-space: pre-wrap;
}

pre code {
display: block; padding: 0.5em;
}

code.r, code.cpp {
background-color: #F8F8F8;
}

table, td, th {
border: none;
}

blockquote {
color:#666666;
margin:0;
padding-left: 1em;
border-left: 0.5em #EEE solid;
}

hr {
height: 0px;
border-bottom: none;
border-top-width: thin;
border-top-style: dotted;
border-top-color: #999999;
}

@media print {
* {
background: transparent !important;
color: black !important;
filter:none !important;
-ms-filter: none !important;
}

body {
font-size:12pt;
max-width:100%;
}

a, a:visited {
text-decoration: underline;
}

hr {
visibility: hidden;
page-break-before: always;
}

pre, blockquote {
padding-right: 1em;
page-break-inside: avoid;
}

tr, img {
page-break-inside: avoid;
}

img {
max-width: 100% !important;
}

@page :left {
margin: 15mm 20mm 15mm 10mm;
}

@page :right {
margin: 15mm 10mm 15mm 20mm;
}

p, h2, h3 {
orphans: 3; widows: 3;
}

h2, h3 {
page-break-after: avoid;
}
}

</style>





</head>

<body>
<pre><code>## Error in R_nc4_open: No such file or directory
</code></pre>

<pre><code>## Error: Error in nc_open trying to open file
## ../output/PEcAn_9/out/9/2004.nc
</code></pre>

<pre><code>## Error in R_nc4_open: No such file or directory
</code></pre>

<pre><code>## Error: Error in nc_open trying to open file
## ../output/PEcAn_1/out/1/2004.nc
</code></pre>

<pre><code>## 2013-03-07 15:24:53 WARN [&lt;text&gt;#5: read.output(run.id = 1, outdir = &quot;../output/PEcAn_1/out/1&quot;, ] : File conversion function model2netcdf does not exist for SIPNET
</code></pre>

<pre><code>## [1] NA
</code></pre>

</body>

</html>

28 changes: 28 additions & 0 deletions qaqc/vignettes/compare ED2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@


```
## Error in R_nc4_open: No such file or directory
```

```
## Error: Error in nc_open trying to open file
## ../output/PEcAn_9/out/9/2004.nc
```

```
## Error in R_nc4_open: No such file or directory
```

```
## Error: Error in nc_open trying to open file
## ../output/PEcAn_1/out/1/2004.nc
```

```
## 2013-03-07 15:24:53 WARN [<text>#5: read.output(run.id = 1, outdir = "../output/PEcAn_1/out/1", ] : File conversion function model2netcdf does not exist for SIPNET
```

```
## [1] NA
```

Loading

0 comments on commit 5616f1c

Please sign in to comment.