Python Snippet
-# Get list of run belonging to the workflow with `workflow_id` = '1000009172'
-response = requests.get(
- "http://pecan.localhost/api/runs/?workflow_id=1000009172",
- auth=HTTPBasicAuth('carya', 'illinois')
- )
-print(json.dumps(response.json(), indent=2))
+# Get list of run belonging to the workflow with `workflow_id` = '1000009172'
+response = requests.get(
+ "http://pecan.localhost/api/runs/?workflow_id=1000009172",
+ auth=HTTPBasicAuth('carya', 'illinois')
+ )
+print(json.dumps(response.json(), indent=2))
## {
## "runs": [
## {
@@ -1792,12 +1790,12 @@
GET /api/runs/{run_id}
R Snippet
-
# Get details of run belonging with `id` = '99000000282'
-res <- httr::GET(
- "http://pecan.localhost/api/runs/99000000282",
- httr::authenticate("carya", "illinois")
- )
-print(jsonlite::fromJSON(rawToChar(res$content)))
+
# Get details of run belonging with `id` = '99000000282'
+res <- httr::GET(
+ "http://pecan.localhost/api/runs/99000000282",
+ httr::authenticate("carya", "illinois")
+ )
+print(jsonlite::fromJSON(rawToChar(res$content)))
## $runtype
## [1] "sensitivity analysis"
@@ -1861,12 +1859,12 @@
@@ -1935,22 +1933,22 @@
GET /api/runs/{run_id}/output/{filename}
R Snippet
-
# Download the '2002.nc' output file for the run with id = 99000000282
-res <- httr::GET(
- "http://pecan.localhost/api/runs/99000000282/output/2002.nc",
- httr::authenticate("carya", "illinois")
- )
-writeBin(res$content, "test.2002.nc")
+
# Download the '2002.nc' output file for the run with id = 99000000282
+res <- httr::GET(
+ "http://pecan.localhost/api/runs/99000000282/output/2002.nc",
+ httr::authenticate("carya", "illinois")
+ )
+writeBin(res$content, "test.2002.nc")
Python Snippet
-
# Download the '2002.nc' output file for the run with id = 99000000282
-response = requests.get(
- "http://pecan.localhost/api/runs/99000000282/output/2002.nc",
- auth=HTTPBasicAuth('carya', 'illinois')
- )
-with open("test.2002.nc", "wb") as file:
- file.write(response.content)
+
# Download the '2002.nc' output file for the run with id = 99000000282
+response = requests.get(
+ "http://pecan.localhost/api/runs/99000000282/output/2002.nc",
+ auth=HTTPBasicAuth('carya', 'illinois')
+ )
+with open("test.2002.nc", "wb") as file:
+ file.write(response.content)
@@ -1960,23 +1958,23 @@
GET /api/runs/{run_id}/graph/{year}/{y_var}
R Snippet
-
# Plot the Gross Primary Productivity vs Time for the run with ID `99000000282` for the year 2002
-res <- httr::GET(
- "http://pecan.localhost/api/runs/99000000282/graph/2002/GPP",
- httr::authenticate("carya", "illinois")
- )
-writeBin(res$content, "test.png")
+
# Plot the Gross Primary Productivity vs Time for the run with ID `99000000282` for the year 2002
+res <- httr::GET(
+ "http://pecan.localhost/api/runs/99000000282/graph/2002/GPP",
+ httr::authenticate("carya", "illinois")
+ )
+writeBin(res$content, "test.png")
Python Snippet
-
# Plot the Gross Primary Productivity vs Time for the run with ID `99000000282` for the year 2002
-response = requests.get(
- "http://pecan.localhost/api/runs/99000000282/graph/2002/GPP",
- auth=HTTPBasicAuth('carya', 'illinois')
- )
-with open("test.png", "wb") as file:
- file.write(response.content)
+
# Plot the Gross Primary Productivity vs Time for the run with ID `99000000282` for the year 2002
+response = requests.get(
+ "http://pecan.localhost/api/runs/99000000282/graph/2002/GPP",
+ auth=HTTPBasicAuth('carya', 'illinois')
+ )
+with open("test.png", "wb") as file:
+ file.write(response.content)
diff --git a/develop/executive-summary-what-to-usually-do.html b/develop/executive-summary-what-to-usually-do.html
index a8ab4a7a6..c120ff497 100644
--- a/develop/executive-summary-what-to-usually-do.html
+++ b/develop/executive-summary-what-to-usually-do.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/faq.html b/develop/faq.html
index d9b68b5e2..5bdb5d2a8 100644
--- a/develop/faq.html
+++ b/develop/faq.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/fetch-latest-data.html b/develop/fetch-latest-data.html
index 8908d9ca9..902af33c7 100644
--- a/develop/fetch-latest-data.html
+++ b/develop/fetch-latest-data.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/fluxnet2015.html b/develop/fluxnet2015.html
index 8e9aa97fb..144214351 100644
--- a/develop/fluxnet2015.html
+++ b/develop/fluxnet2015.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/fluxnetlathuile.html b/develop/fluxnetlathuile.html
index bfb9aceaa..4944c859f 100644
--- a/develop/fluxnetlathuile.html
+++ b/develop/fluxnetlathuile.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/general-feedbackcommentssuggestions.html b/develop/general-feedbackcommentssuggestions.html
index 702a83fed..8e392ec40 100644
--- a/develop/general-feedbackcommentssuggestions.html
+++ b/develop/general-feedbackcommentssuggestions.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/geostreams.html b/develop/geostreams.html
index 197249f91..a44cedf03 100644
--- a/develop/geostreams.html
+++ b/develop/geostreams.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/get-model-output.html b/develop/get-model-output.html
index 8a04ed0b7..16430781f 100644
--- a/develop/get-model-output.html
+++ b/develop/get-model-output.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/gldas.html b/develop/gldas.html
index e09d90f03..6f1920c6f 100644
--- a/develop/gldas.html
+++ b/develop/gldas.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/glossary.html b/develop/glossary.html
index 640927533..815a13e97 100644
--- a/develop/glossary.html
+++ b/develop/glossary.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/helper-functions-for-unit-tests.html b/develop/helper-functions-for-unit-tests.html
index 5f294414b..3a7ed8992 100644
--- a/develop/helper-functions-for-unit-tests.html
+++ b/develop/helper-functions-for-unit-tests.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/how-does-it-work.html b/develop/how-does-it-work.html
index 82cf1a329..92e7d0134 100644
--- a/develop/how-does-it-work.html
+++ b/develop/how-does-it-work.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/how-to-create-your-own-version-of-documentation.html b/develop/how-to-create-your-own-version-of-documentation.html
index d8c0e9eb4..eca587e4b 100644
--- a/develop/how-to-create-your-own-version-of-documentation.html
+++ b/develop/how-to-create-your-own-version-of-documentation.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/icos-drought-2018.html b/develop/icos-drought-2018.html
index 078ea2668..f6a6f0fef 100644
--- a/develop/icos-drought-2018.html
+++ b/develop/icos-drought-2018.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/icos-ecosystem-archive.html b/develop/icos-ecosystem-archive.html
index dc092c0b1..b33e48eef 100644
--- a/develop/icos-ecosystem-archive.html
+++ b/develop/icos-ecosystem-archive.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/importing-functions-use-roxygen.html b/develop/importing-functions-use-roxygen.html
index c2b33bd8c..0e093ac4e 100644
--- a/develop/importing-functions-use-roxygen.html
+++ b/develop/importing-functions-use-roxygen.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
@@ -780,15 +778,15 @@
Importing Functions: Use Roxygen
PEcAn style is to import very few functions and instead use fully namespaced function calls (pkg::fn()
) everywhere it’s practical to do so. In cases where double-colon notation would be especially burdensome, such as when importing custom binary operators like %>%
, it’s acceptable to import specific functions into the package namespace. Do this by using Roxygen comments of the form #' @importFrom pkg function
, not by hand-editing the NAMESPACE file.
If the import is only used in one or a few functions, use an @importFrom
in the documentation for each function that uses it. If it is used all over the package, use a single @importFrom
in the Roxygen documentation block for the whole package, which probably lives in a file called either zzz.R
or <your_package_name>-package.R
:
-#' What your package does
-#'
-#' Longer description of the package goes here.
-#' Probably with links to other resources about it, citations, etc.
-#'
-#' @docType package
-#' @name PEcAn.yourpkg
-#' @importFrom magrittr %>%
-NULL
+#' What your package does
+#'
+#' Longer description of the package goes here.
+#' Probably with links to other resources about it, citations, etc.
+#'
+#' @docType package
+#' @name PEcAn.yourpkg
+#' @importFrom magrittr %>%
+NULL
Roxygen will make sure there’s only one NAMESPACE entry per imported function no matter how many importFrom
statements there are, but please pick a scheme (either import on every usage or once for the whole package), stick with it, and do not make function x()
rely on an importFrom in the comments above function y()
.
Please do not import entire package namespaces (#' @import pkg
); it increases the chance of function name collisions and makes it much harder to understand which package a given function was called from.
A special note about importing functions from the tidyverse: Be sure to import from the package(s) that actually contain the functions you want to use, e.g. Imports: dplyr, magrittr, purrr
/ @importFrom magrittr %>%
/ purrr::map(...)
, not Imports: tidyverse
/ @importFrom tidyverse %>%
/ tidyverse::map(...)
. The package named tidyverse
is just a interactive shortcut that loads the whole collection of constituent packages; it doesn’t export any functions in its own namespace and therefore importing it into your package doesn’t make them available.
diff --git a/develop/index.html b/develop/index.html
index 9b436af54..105515e9f 100644
--- a/develop/index.html
+++ b/develop/index.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
@@ -779,7 +777,7 @@
Welcome
diff --git a/develop/install-docker.html b/develop/install-docker.html
index 532242b1d..fb6d0b710 100644
--- a/develop/install-docker.html
+++ b/develop/install-docker.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/install-native.html b/develop/install-native.html
index 10082a882..fbb5665e6 100644
--- a/develop/install-native.html
+++ b/develop/install-native.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/install-vm.html b/develop/install-vm.html
index feacb1e2d..05c36bf6c 100644
--- a/develop/install-vm.html
+++ b/develop/install-vm.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/installation-details.html b/develop/installation-details.html
index db30031f8..58b69ab44 100644
--- a/develop/installation-details.html
+++ b/develop/installation-details.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/installing-dependencies-let-the-machines-do-it.html b/develop/installing-dependencies-let-the-machines-do-it.html
index f6364a7f8..276c35cc2 100644
--- a/develop/installing-dependencies-let-the-machines-do-it.html
+++ b/develop/installing-dependencies-let-the-machines-do-it.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/intermediate-user.html b/develop/intermediate-user.html
index bf6aacf20..ff033f6d5 100644
--- a/develop/intermediate-user.html
+++ b/develop/intermediate-user.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
@@ -782,7 +780,6 @@ More on the PEcAn Web Interface
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/list-of-expectations.html b/develop/list-of-expectations.html
index c22dea7aa..0a825e4a6 100644
--- a/develop/list-of-expectations.html
+++ b/develop/list-of-expectations.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/load-settings.html b/develop/load-settings.html
index d7a97d5bd..3b665a458 100644
--- a/develop/load-settings.html
+++ b/develop/load-settings.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/loading-code-dont-but-use-requirenamespace-when-you-do.html b/develop/loading-code-dont-but-use-requirenamespace-when-you-do.html
index e80feb01c..611aeb59e 100644
--- a/develop/loading-code-dont-but-use-requirenamespace-when-you-do.html
+++ b/develop/loading-code-dont-but-use-requirenamespace-when-you-do.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
@@ -782,13 +780,13 @@ Loading Code: Don’t… But
The longer version requires that we make a distinction often glossed over: Loading a package makes it possible for R to find things in the package namespace and does any actions needed to make it ready for use (e.g. running its .onLoad method, loading DLLs if the package contains compiled code, etc). Attaching a package (usually by calling library("somePackage")
) loads it if it wasn’t already loaded, and then adds it to the search path so that the user can find things in its namespace. As discussed in the “Declaring Dependancies” section above, dependencies listed in Depends
will be attached when your package is attached, but they will be neither attached nor loaded when your package is loaded without being attached.
Loading a dependency into the package namespace is undesirable because it makes it hard to understand our own code – if we need to use something from elsewhere, we’d prefer call it from its own namespace using ::
(which implicitly loads the dependency!) or explicitly import it with a Roxygen @import
directive. But in a few cases this isn’t enough. The most common reason to need to explicitly load a dependency is that some packages define new S3 methods for generic functions defined in other packages, but do not export these methods directly. We would prefer that these packages did not do this, but sometimes we have to use them anyway. An example from PEcAn is that PEcAn.MA needs to call as.matrix
on objects of class mcmc.list
. When the coda
namespace is loaded, as.matrix(some_mcmc.list)
can be correctly dispatched by base::as.matrix
to the unexported method coda:::as.matrix.mcmc.list
, but when coda
is not loaded this dispatch will fail. Unfortunately coda does not export as.matrix.mcmc.list
so we cannot call it directly or import it into the PEcAn.MA namespace, so instead we load the coda
namespace whenever PEcAn.MA is loaded.
Attaching packages to the user’s search path is even more problematic because it makes it hard for the user to understand how your package will affect their own code. Packages attached by a function stay attached after the function exits, so they can cause name collisions far downstream of the function call, potentially in code that has nothing to do with your package. And worse, since names are looked up in reverse order of package loading, it can cause behavior that differs in strange ways depending on the order of lines that look independent of each other:
-library(Hmisc)
-x = ...
-y = 3
-summarize(x) # calls Hmisc::summarize
-y2 <- some_package_that_attaches_dplyr::innocent.looking.function(y)
-# Loading required package: dplyr
-summarize(x) # Looks identical to previous summarize, but calls dplyr::summarize!
+library(Hmisc)
+x = ...
+y = 3
+summarize(x) # calls Hmisc::summarize
+y2 <- some_package_that_attaches_dplyr::innocent.looking.function(y)
+# Loading required package: dplyr
+summarize(x) # Looks identical to previous summarize, but calls dplyr::summarize!
This is not to say that users will never want your package to attach another one for them, just that it’s rare and that attaching dependencies is much more likely to cause bugs than to fix them and additionally doesn’t usually save the package author any work.
One possible exception to the do-not-attach-packages rule is a case where your dependency ignores all good practice and wrongly assumes, without checking, that all of its own dependencies are attached; if its DESCRIPTION uses only Depends
instead of Imports
, this is often a warning sign. For example, a small-but-surprising number of packages depend on the methods
package without proper checks (this is probably because most but not all R interpreters attach methods
by default and therefore it’s easy for an author to forget it might ever be otherwise unless they happen to test with a but-not-all interpreter).
If you find yourself with a dependency that does this, accept first that you are relying on a package that is broken, and you should either convince its maintainer to fix it or find a way to remove the dependency from PEcAn. But as a short-term workaround, it is sometimes possible for your code to attach the direct dependency so that it will behave right with regard to its secondary dependencies. If so, make sure the attachment happens every time your package is loaded (e.g. by calling library(depname)
inside your package’s .onLoad
method) and not just when your package is attached (e.g. by putting it in Depends).
diff --git a/develop/maintain-vm.html b/develop/maintain-vm.html
index 8ccf799a0..a327c6870 100644
--- a/develop/maintain-vm.html
+++ b/develop/maintain-vm.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/met-drivers.html b/develop/met-drivers.html
index 9c7ab62d1..ed9b7dd1c 100644
--- a/develop/met-drivers.html
+++ b/develop/met-drivers.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/meta-analysis.html b/develop/meta-analysis.html
index 4282e21d1..8c0b3c849 100644
--- a/develop/meta-analysis.html
+++ b/develop/meta-analysis.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/miscellaneous.html b/develop/miscellaneous.html
index f456b53dd..da93ac563 100644
--- a/develop/miscellaneous.html
+++ b/develop/miscellaneous.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
diff --git a/develop/model-docker.html b/develop/model-docker.html
index 4faf2fdf9..630fffce1 100644
--- a/develop/model-docker.html
+++ b/develop/model-docker.html
@@ -23,7 +23,7 @@
-
+
@@ -230,9 +230,8 @@
7.1 Additional web configuration
7.2 Settings-configured analyses
13 PEcAn workflow (web/workflow.R)
@@ -787,21 +785,21 @@ Models using Docker25.5.1 Model information
Each model will have a small json file called model_info.json that is used to describe the model and used by the monitor service to register the model with PEcAn. This file will contain information about the model that is send as part of the heartbeat of the container to the monitor service. Below is an example of this file for the ED model. The required fields are name
, type
, version
and binary
. The fields type
and version
are used by PEcAn to send the messages to RabbitMQ. There is no need to specify the queue name explicitly. The queue name will be created by combining these two fields with an underscore. The field binary
is used to point to the actual binary in the docker container.
There are 2 special values that can be used, @VERSION@
which will be replaced by the version that is passed in when building the container, and @BINARY@
which will be replaced by the binary when building the docker image.
-{
- "name": "ED2.2",
- "type": "ED2",
- "version": "@VERSION@",
- "binary": "@BINARY@",
- "description": "The Ecosystem Demography Biosphere Model (ED2) is an integrated terrestrial biosphere model incorporating hydrology, land-surface biophysics, vegetation dynamics, and soil carbon and nitrogen biogeochemistry",
- "author": "Mike Dietze",
- "contributors": ["David LeBauer", "Xiaohui Feng", "Dan Wang", "Carl Davidson", "Rob Kooper", "Shawn Serbin", "Alexey Shiklomanov"],
- "links": {
- "source": "https://github.com/EDmodel/ED2",
- "issues": "https://github.com/EDmodel/ED2/issues"
- },
- "inputs": {},
- "citation": ["Medvigy D., Wofsy S. C., Munger J. W., Hollinger D. Y., Moorcroft P. R. 2009. Mechanistic scaling of ecosystem function and dynamics in space and time: Ecosystem Demography model version 2. J. Geophys. Res. 114 (doi:10.1029/2008JG000812)"]
-}
+{
+ "name": "ED2.2",
+ "type": "ED2",
+ "version": "@VERSION@",
+ "binary": "@BINARY@",
+ "description": "The Ecosystem Demography Biosphere Model (ED2) is an integrated terrestrial biosphere model incorporating hydrology, land-surface biophysics, vegetation dynamics, and soil carbon and nitrogen biogeochemistry",
+ "author": "Mike Dietze",
+ "contributors": ["David LeBauer", "Xiaohui Feng", "Dan Wang", "Carl Davidson", "Rob Kooper", "Shawn Serbin", "Alexey Shiklomanov"],
+ "links": {
+ "source": "https://github.com/EDmodel/ED2",
+ "issues": "https://github.com/EDmodel/ED2/issues"
+ },
+ "inputs": {},
+ "citation": ["Medvigy D., Wofsy S. C., Munger J. W., Hollinger D. Y., Moorcroft P. R. 2009. Mechanistic scaling of ecosystem function and dynamics in space and time: Ecosystem Demography model version 2. J. Geophys. Res. 114 (doi:10.1029/2008JG000812)"]
+}
Other fields that are recommended, but currently not used yet, are:
+docker build \
+ --tag pecan/model-ed2-git \
+ --file models/ed/Dockerfile \
+ .
Example of a Dockerfile, in this case to build the ED2 model.
-ARG IMAGE_VERSION="latest"
-# ----------------------------------------------------------------------
-# BUILD MODEL BINARY
-# ----------------------------------------------------------------------
-FROM pecan/models:${IMAGE_VERSION} as model-binary
-
-# Some variables that can be used to set control the docker build
-ARG MODEL_VERSION=git
-
-# install dependencies
-RUN apt-get update \
- && apt-get install -y --no-install-recommends \
- build-essential \
- curl \
- gfortran \
- git \
- libhdf5-dev \
- libopenmpi-dev \
- && rm -rf /var/lib/apt/lists/*
-
-# download, unzip and build ed2
-WORKDIR /src
-RUN git -c http.sslVerify=false clone https://github.com/EDmodel/ED2.git \
- && cd ED2/ED/build \
- && curl -o make/include.mk.VM http://isda.ncsa.illinois.edu/~kooper/EBI/include.mk.opt.Linux \
- && if [ "${MODEL_VERSION}" != "git" ]; then git checkout ${MODEL_VERSION}; fi \
- && ./install.sh -g -p VM
-
-########################################################################
-
-# ----------------------------------------------------------------------
-# BUILD PECAN FOR MODEL
-# ----------------------------------------------------------------------
-FROM pecan/models:latest
-
-# ----------------------------------------------------------------------
-# INSTALL MODEL SPECIFIC PIECES
-# ----------------------------------------------------------------------
-
-RUN apt-get update \
- && apt-get install -y --no-install-recommends \
- libgfortran3 \
- libopenmpi2 \
- && rm -rf /var/lib/apt/lists/*
-
-# ----------------------------------------------------------------------
-# SETUP FOR SPECIFIC MODEL
-# ----------------------------------------------------------------------
-
-# Some variables that can be used to set control the docker build
-ARG MODEL_VERSION=git
-
-# Setup model_info file
-COPY models/ed/model_info.json /work/model.json
-RUN sed -i -e "s/@VERSION@/${MODEL_VERSION}/g" \
- -e "s#@BINARY@#/usr/local/bin/ed2.${MODEL_VERSION}#g" /work/model.json
-
-# COPY model binary
-COPY --from=model-binary /src/ED2/ED/build/ed_2.1-opt /usr/local/bin/ed2.${MODEL_VERSION}
+ARG IMAGE_VERSION="latest"
+# ----------------------------------------------------------------------
+# BUILD MODEL BINARY
+# ----------------------------------------------------------------------
+FROM pecan/models:${IMAGE_VERSION} as model-binary
+
+# Some variables that can be used to set control the docker build
+ARG MODEL_VERSION=git
+
+# install dependencies
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ build-essential \
+ curl \
+ gfortran \
+ git \
+ libhdf5-dev \
+ libopenmpi-dev \
+ && rm -rf /var/lib/apt/lists/*
+
+# download, unzip and build ed2
+WORKDIR /src
+RUN git -c http.sslVerify=false clone https://github.com/EDmodel/ED2.git \
+ && cd ED2/ED/build \
+ && curl -o make/include.mk.VM http://isda.ncsa.illinois.edu/~kooper/EBI/include.mk.opt.Linux \
+ && if [ "${MODEL_VERSION}" != "git" ]; then git checkout ${MODEL_VERSION}; fi \
+ && ./install.sh -g -p VM
+
+########################################################################
+
+# ----------------------------------------------------------------------
+# BUILD PECAN FOR MODEL
+# ----------------------------------------------------------------------
+FROM pecan/models:latest
+
+# ----------------------------------------------------------------------
+# INSTALL MODEL SPECIFIC PIECES
+# ----------------------------------------------------------------------
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends \
+ libgfortran3 \
+ libopenmpi2 \
+ && rm -rf /var/lib/apt/lists/*
+
+# ----------------------------------------------------------------------
+# SETUP FOR SPECIFIC MODEL
+# ----------------------------------------------------------------------
+
+# Some variables that can be used to set control the docker build
+ARG MODEL_VERSION=git
+
+# Setup model_info file
+COPY models/ed/model_info.json /work/model.json
+RUN sed -i -e "s/@VERSION@/${MODEL_VERSION}/g" \
+ -e "s#@BINARY@#/usr/local/bin/ed2.${MODEL_VERSION}#g" /work/model.json
+
+# COPY model binary
+COPY --from=model-binary /src/ED2/ED/build/ed_2.1-opt /usr/local/bin/ed2.${MODEL_VERSION}
WARNING: Dockerfile environment variables set via ENV
are assigned all at once; they do not evaluate successively, left to right.
Consider the following block:
-# Don't do this!
-ENV MODEL_TYPE="SIPNET" \
- MODEL_VERSION=136 \
- MODEL_TYPE_VERSION=${MODEL_TYPE}_${MODEL_VERSION} # <- Doesn't know about MODEL_TYPE or MODEL_VERSION!
+# Don't do this!
+ENV MODEL_TYPE="SIPNET" \
+ MODEL_VERSION=136 \
+ MODEL_TYPE_VERSION=${MODEL_TYPE}_${MODEL_VERSION} # <- Doesn't know about MODEL_TYPE or MODEL_VERSION!
In this block, the expansion for setting MODEL_TYPE_VERSION
is not aware of the current values of MODEL_TYPE
or MODEL_VERSION
, and will therefore be set incorrectly to just _
(unless they have been set previously, in which case it will be aware only of their earlier values).
As such, variables depending on other variables must be set in a separate, subsequent ENV
statement than the variables they depend on.
Once the model has build and is working we can add it to the PEcAn stack and be able to use this model in the web interface. There are two methods to start this new model. First, we can add it to the docker-compose.yml
file and start the container using docker-compose -p pecan -d up
.
- sipnet:
- image: pecan/model-ed2-git
- networks:
- - pecan
- volumes:
- - pecan:/data
- depends_on:
- - rabbitmq
- restart: unless-stopped
+ sipnet:
+ image: pecan/model-ed2-git
+ networks:
+ - pecan
+ volumes:
+ - pecan:/data
+ depends_on:
+ - rabbitmq
+ restart: unless-stopped
Alternatively we can start the container manually using the following command.
-docker run \
- --detach \
- --rm \
- --name pecan-ed2-git \
- --networks pecan_pecan \
- --volume pecan_pecan:/data
- pecan/model-ed2-git
+docker run \
+ --detach \
+ --rm \
+ --name pecan-ed2-git \
+ --networks pecan_pecan \
+ --volume pecan_pecan:/data
+ pecan/model-ed2-git