Skip to content

Commit 9571570

Browse files
authored
Merge branch 'develop' into model-run-workflow
2 parents 2cba6f0 + 80e1b7a commit 9571570

32 files changed

+921
-785
lines changed

.github/workflows/pkgdown.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: renderpkgdown
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
tags:
9+
- '*'
10+
pull_request:
11+
merge_group:
12+
workflow_dispatch:
13+
14+
jobs:
15+
pkgdown:
16+
runs-on: ubuntu-latest
17+
env:
18+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19+
20+
container:
21+
image: pecan/depends:develop
22+
23+
steps:
24+
# Checkout source code
25+
- uses: actions/checkout@v4
26+
27+
# Install pkgdown
28+
- name: Install dependencies
29+
run: Rscript -e 'install.packages("pkgdown")'
30+
31+
# Generate documentation using Makefile
32+
- name: Generate Package Documentation
33+
run: make pkgdocs
34+
35+
# Check if package documentation repo exists
36+
- name: Check if package documentation repo exists
37+
id: pkgdoc_exists
38+
run: |
39+
if git ls-remote https://github.com/${{ github.repository_owner }}/package-documentation.git > /dev/null 2>&1; then
40+
echo "exists=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "exists=false" >> $GITHUB_OUTPUT
43+
fi
44+
45+
# Checkout package documentation repo
46+
- name: Checkout package documentation repo
47+
if: ${{ github.event_name == 'push' && steps.pkgdoc_exists.outputs.exists == 'true' }}
48+
uses: actions/checkout@v4
49+
with:
50+
repository: ${{ github.repository_owner }}/package-documentation
51+
path: package-documentation
52+
token: ${{ secrets.GH_PAT }}
53+
54+
# Deploy Pkgdown documentation
55+
- name: Publish to github
56+
if: github.event_name == 'push'
57+
run: |
58+
git config --global user.email "[email protected]"
59+
git config --global user.name "GitHub Documentation Robot"
60+
export VERSION=$(echo $GITHUB_REF | sed 's,.*/,,' )
61+
if [ "$VERSION" = "main" ]; then
62+
export VERSION=latest
63+
fi
64+
cd package-documentation
65+
mkdir -p $VERSION
66+
rsync -a --delete pkgdocs/ ${VERSION}/
67+
git add --all *
68+
git commit -m "Build pkgdown docs from pecan revision ${GITHUB_SHA}" || true
69+
git push -q origin main

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ For more information about this file see also [Keep a Changelog](http://keepacha
1313
- Add make option to document a single package with `make documentation pathto/package`
1414
- `settings$host$qsub` and `settings$host$modellauncher$qsub.extra` will now expand `@NJOBS@` to the number of models in the run, allowing e.g. `--array=1-@NJOBS@`. Note that qsub still by default submits every model as a separate job, so for now this is mostly useful for custom modellauncher scripts
1515

16+
- Added automated pkgdown documentation for all PEcAn packages (@divine7022, #3482):
17+
- Compiled pages are live at https://pecanproject.github.io/package-documentation and inside Docker at `pecan.localhost/pkgdocs/`, and these are automatically updated each time a PR to the source packages is merged.
18+
- You can compile all pkgdown pages locally at any time with `make pkgdocs`.
19+
1620
### Fixed
1721
- updated github action to build docker images
1822
- PEcAn.SIPNET now accepts relative paths in its input XML (#3418). Previously all files referenced in the autogenerated `job.sh` needed to be specified as absolute paths.

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
SHELL = /bin/bash
12
NCPUS ?= 1
23

34
BASE := logger utils db settings visualization qaqc remote workflow
@@ -104,18 +105,22 @@ depends = .doc/$(1) .install/$(1) .check/$(1) .test/$(1)
104105

105106
### Rules
106107

107-
.PHONY: all install check test document clean shiny \
108-
check_base check_models check_modules document help
108+
.PHONY: all install check test document clean shiny pkgdocs \
109+
check_base check_models check_modules help
109110

110111
all: install document
111112

112-
# Note: Installs base first as Modules has a circular dependency on base
113+
# Note: Installs base first as Modules has a circular dependency on base
113114
check_base: $(BASE_C)
114115
check_models: $(MODELS_C)
115116
check_modules: $(BASE_I) $(MODULES_C)
116117

117118
document: $(ALL_PKGS_D) .doc/base/all
118119

120+
pkgdocs:
121+
Rscript scripts/build_pkgdown.R $(ALL_PKGS) base/all || exit 1
122+
123+
119124
install: $(ALL_PKGS_I) .install/base/all
120125
check: $(ALL_PKGS_C) .check/base/all
121126
test: $(ALL_PKGS_T) .test/base/all
@@ -159,6 +164,7 @@ help:
159164
@echo " test Run unit tests on all packages"
160165
@echo " shiny Install dependencies for Shiny apps"
161166
@echo " book Render the PEcAn bookdown documentation"
167+
@echo " pkgdocs Build package documentation websites using pkgdown"
162168
@echo " clean Remove build artifacts"
163169
@echo " help Show this help message"
164170

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0"?>
2+
<pecan>
3+
<info>
4+
<notes></notes>
5+
<userid>-1</userid>
6+
<username></username>
7+
<date>2025/03/24 10:37:56 +0000</date>
8+
</info>
9+
<outdir>/data/workflows/PEcAn_99000000005</outdir>
10+
<database>
11+
<bety>
12+
<user>bety</user>
13+
<password>bety</password>
14+
<host>postgres</host>
15+
<port>5432</port>
16+
<dbname>bety</dbname>
17+
<driver>PostgreSQL</driver>
18+
<write>true</write>
19+
</bety>
20+
<dbfiles>/data/dbfiles</dbfiles>
21+
</database>
22+
<pfts>
23+
<pft>
24+
<name>temperate.coniferous</name>
25+
</pft>
26+
</pfts>
27+
<meta.analysis>
28+
<iter>3000</iter>
29+
<random.effects>
30+
<on>FALSE</on>
31+
<use_ghs>TRUE</use_ghs>
32+
</random.effects>
33+
</meta.analysis>
34+
<ensemble>
35+
<size>1</size>
36+
<variable>NPP</variable>
37+
<samplingspace>
38+
<parameters>
39+
<method>uniform</method>
40+
</parameters>
41+
<met>
42+
<method>sampling</method>
43+
</met>
44+
</samplingspace>
45+
</ensemble>
46+
<model>
47+
<id>99000000003</id>
48+
</model>
49+
<workflow>
50+
<id>99000000005</id>
51+
</workflow>
52+
<run>
53+
<site>
54+
<id>772</id>
55+
<met.start>2004/01/01</met.start>
56+
<met.end>2004/12/31</met.end>
57+
</site>
58+
<inputs>
59+
<met>
60+
<source>AmerifluxLBL</source>
61+
<output>SIPNET</output>
62+
<username>Aritra_2023</username>
63+
</met>
64+
</inputs>
65+
<start.date>2004/01/01</start.date>
66+
<end.date>2004/12/31</end.date>
67+
</run>
68+
<host>
69+
<name>localhost</name>
70+
<rabbitmq>
71+
<uri>amqp://guest:guest@rabbitmq/%2F</uri>
72+
<queue>SIPNET_git</queue>
73+
</rabbitmq>
74+
</host>
75+
</pecan>

base/settings/R/read.settings.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#'
3434
#' settings <- read.settings()
3535
#' settings <- read.settings(file="willowcreek.xml")
36-
#' test.settings.file <- system.file("tests/test.xml", package = "PEcAn.all")
36+
#' test.settings.file <- system.file("tests/test.xml", package = "PEcAn.settings")
3737
#' settings <- read.settings(test.settings.file)
3838
#' }
3939
read.settings <- function(inputfile = "pecan.xml") {

base/settings/man/read.settings.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

book_source/02_demos_tutorials_workflows/02_user_demos/01_introductions_user.Rmd

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ The following Tutorials assume you have installed PEcAn. If you have not, please
88

99
|Type|Title|Web Link| Source Rmd|
1010
|:--:|:---:|:------:|:---------:|
11-
|Demo| Basic Run| [html](#demo-1) | [Rmd](https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/01_Demo_Basic_Run/Demo01.Rmd)|
12-
|Demo| Uncertainty Analysis| [html](#demo-2) | [Rmd](https://github.com/PecanProject/pecan/tree/main/documentation/tutorials/02_Demo_Uncertainty_Analysis)|
13-
|Demo| Output Analysis|html |[Rmd](https://github.com/PecanProject/pecan/tree/develop/documentation/tutorials/AnalyzeOutput)|
14-
|Demo| MCMC |html|[Rmd](https://github.com/PecanProject/pecan/tree/develop/documentation/tutorials/MCMC)|
15-
|Demo|Parameter Assimilation |html |[Rmd](https://github.com/PecanProject/pecan/tree/develop/documentation/tutorials/ParameterAssimilation)|
16-
|Demo|State Assimilation|html|[Rmd](https://github.com/PecanProject/pecan/tree/develop/documentation/tutorials/StateAssimilation)|
17-
|Demo| Sensitivity|html|[Rmd](https://github.com/PecanProject/pecan/tree/develop/documentation/tutorials/sensitivity)|
18-
|Vignette|Allometries|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/allometry/vignettes/AllomVignette.Rmd)|
19-
|Vignette|MCMC|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/assim.batch/vignettes/AssimBatchVignette.Rmd)|
20-
|Vignette|Meteorological Data|html|[Rmd](https://github.com/PecanProject/pecan/tree/main/modules/data.atmosphere/vignettes)|
21-
|Vignette|Meta-Analysis|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/meta.analysis/vignettes/single.MA_demo.Rmd)|
22-
|Vignette|Photosynthetic Response Curves|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/photosynthesis/vignettes/ResponseCurves.Rmd)|
23-
|Vignette|Priors|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/priors/vignettes/priors_demo.Rmd)|
24-
|Vignette|Leaf Spectra:PROSPECT inversion|html|[Rmd](https://github.com/PecanProject/pecan/blob/main/modules/rtm/vignettes/pecanrtm.vignette.Rmd)|
11+
|Demo| Basic Run| [html](#demo-1) | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/01_Demo_Basic_Run/Demo01.Rmd" target = "_blank">Rmd</a> |
12+
|Demo| Uncertainty Analysis| [html](#demo-2)| <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/02_Demo_Uncertainty_Analysis/Demo02.Rmd" target = "_blank">Rmd</a> |
13+
|Demo| Output Analysis|html | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/AnalyzeOutput/modelVSdata.Rmd" target="_blank">Rmd</a> |
14+
|Demo| MCMC |html| <a href= "https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/MCMC/MCMC_Concepts.Rmd" target = "_blank">Rmd</a> |
15+
|Demo|Parameter Assimilation |html | <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/ParameterAssimilation/PDA.Rmd" target = "_blank">Rmd</a> |
16+
|Demo|State Assimilation|html| <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/StateAssimilation/TreeRingSDA.Rmd" target = "_blank">Rmd</a> |
17+
|Demo| Sensitivity|html| <a href="https://github.com/PecanProject/pecan/blob/develop/documentation/tutorials/sensitivity/PEcAn_sensitivity_tutorial_v1.0.Rmd" target = "_blank">Rmd</a> |
18+
|Vignette|Allometries|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/allometry/vignettes/AllomVignette.Rmd" target = "_blank">Rmd</a> |
19+
|Vignette|MCMC|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/assim.batch/vignettes/AssimBatchVignette.Rmd" target = "_blank">Rmd</a> |
20+
|Vignette|Meteorological Data|html| <a href="https://github.com/PecanProject/pecan/tree/develop/modules/data.atmosphere/vignettes" target = "_blank">Rmd</a> |
21+
|Vignette|Meta-Analysis|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/meta.analysis/vignettes/single.MA_demo.Rmd" target = "_blank">Rmd</a> |
22+
|Vignette|Photosynthetic Response Curves|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/photosynthesis/vignettes/ResponseCurves.Rmd" target = "_blank">Rmd</a> |
23+
|Vignette|Priors|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/priors/vignettes/priors_demo.Rmd" target = "_blank">Rmd</a> |
24+
|Vignette|Leaf Spectra:PROSPECT inversion|html| <a href="https://github.com/PecanProject/pecan/blob/develop/modules/rtm/vignettes/pecanrtm.vignette.Rmd" target = "_blank">Rmd</a> |

docker/depends/pecan_deps_from_github.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ ropensci/nneo
88
ropensci/traits
99
SticsRPacks/SticsOnR
1010
SticsRPacks/SticsRFiles
11-
VangiElia/GEDI4R

docker/depends/pecan_package_dependencies.csv

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"future","*","modules/data.atmosphere","Suggests",FALSE
7878
"future","*","modules/data.land","Imports",FALSE
7979
"future","*","modules/data.remote","Imports",FALSE
80-
"GEDI4R","*","modules/data.remote","Suggests",FALSE
8180
"geonames","> 0.998","modules/data.atmosphere","Imports",FALSE
8281
"getPass","*","base/remote","Suggests",FALSE
8382
"getPass","*","modules/data.atmosphere","Suggests",FALSE
@@ -165,7 +164,7 @@
165164
"lubridate",">= 1.6.0","modules/assim.sequential","Imports",FALSE
166165
"lubridate",">= 1.6.0","modules/benchmark","Imports",FALSE
167166
"lubridate",">= 1.6.0","modules/data.atmosphere","Imports",FALSE
168-
"lubridate",">= 1.6.0","modules/rtm","Imports",FALSE
167+
"lubridate",">= 1.6.0","modules/rtm","Suggests",FALSE
169168
"lubridate",">= 1.7.0","models/biocro","Imports",FALSE
170169
"Maeswrap","*","models/maespa","Suggests",FALSE
171170
"magic",">= 1.5.0","modules/assim.sequential","Suggests",FALSE
@@ -487,7 +486,6 @@
487486
"rlang","*","modules/assim.sequential","Imports",FALSE
488487
"rlang","*","modules/benchmark","Imports",FALSE
489488
"rlang","*","modules/data.land","Imports",FALSE
490-
"rlang","*","modules/data.remote","Imports",FALSE
491489
"rlang","*","modules/uncertainty","Imports",FALSE
492490
"rlang",">= 0.2.0","modules/data.atmosphere","Imports",FALSE
493491
"rlist","*","modules/assim.sequential","Suggests",FALSE
@@ -565,6 +563,7 @@
565563
"stats","*","modules/assim.batch","Imports",FALSE
566564
"stats","*","modules/assim.sequential","Suggests",FALSE
567565
"stats","*","modules/photosynthesis","Imports",FALSE
566+
"stats","*","modules/rtm","Imports",FALSE
568567
"SticsRFiles","*","models/stics","Suggests",FALSE
569568
"stringi","*","base/logger","Imports",FALSE
570569
"stringi","*","base/utils","Imports",FALSE

docker/docs/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@ RUN apt-get update \
1515
-e 'remotes::install_version("rmarkdown", ">= 2.19", dependencies = TRUE, upgrade = FALSE, repos = repos)' \
1616
-e 'remotes::install_version("knitr", ">= 1.42", dependencies = TRUE, upgrade = FALSE, repos = repos)' \
1717
-e 'remotes::install_version("bookdown", ">= 0.31", dependencies = TRUE, upgrade = FALSE, repos = repos)' \
18+
-e 'install.packages("pkgdown", repos = repos)' \
1819
&& rm -rf /var/lib/apt/lists/*
1920

21+
# ----------------------------------------------------------------------
22+
# Compile bookdown documentation
23+
# ----------------------------------------------------------------------
2024
WORKDIR /src/book_source/
2125
COPY book_source /src/book_source/
2226
COPY documentation /src/documentation/
2327
COPY docker-compose.yml /src/
2428
COPY docker/env.example /src/docker/
2529
RUN make build
2630

31+
# ----------------------------------------------------------------------
32+
# Build pkgdown documentation
33+
# ----------------------------------------------------------------------
34+
WORKDIR /pkgdoc/
35+
COPY Makefile Makefile.depends /pkgdoc/
36+
COPY scripts/build_pkgdown.R /pkgdoc/scripts/build_pkgdown.R
37+
COPY base /pkgdoc/base/
38+
COPY modules /pkgdoc/modules/
39+
COPY models /pkgdoc/models/
40+
RUN make clean && make pkgdocs
41+
2742
# ----------------------------------------------------------------------
2843
# copy html pages to container
2944
# ----------------------------------------------------------------------
@@ -36,6 +51,7 @@ RUN apt-get update \
3651

3752
COPY docker/docs/index.html /usr/local/apache2/htdocs/
3853
COPY --from=pecandocs /src/book_source/_book/ /usr/local/apache2/htdocs/docs/pecan/
54+
COPY --from=pecandocs /pkgdoc/package_documentation/pkgdocs/ /usr/local/apache2/htdocs/pkgdocs/
3955

4056
# ----------------------------------------------------------------------
4157
# PEcAn version information

0 commit comments

Comments
 (0)