Skip to content

Commit

Permalink
Merge branch 'develop' into fix/docker-pull-arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
dlebauer authored Feb 21, 2025
2 parents 67b7e3f + 0bc4edd commit 113e39a
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

container:
image: pecan/depends:R4.1
image: pecan/depends:develop-R4.1

steps:
# checkout source code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
_R_CHECK_SYSTEM_CLOCK_: 0

container:
image: pecan/depends:R${{ inputs.R-version }}
image: pecan/depends:develop-R${{ inputs.R-version }}

steps:
# checkout source code
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
matrix:
R:
- "4.3"
- "4.4"
- "devel"
uses: ./.github/workflows/test.yml
with:
Expand All @@ -26,6 +27,7 @@ jobs:
matrix:
R:
- "4.3"
- "4.4"
- "devel"
uses: ./.github/workflows/check.yml
with:
Expand All @@ -39,6 +41,7 @@ jobs:
matrix:
R:
- "4.3"
- "4.4"
- "devel"
uses: ./.github/workflows/sipnet.yml
with:
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/docker-build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ jobs:
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=branch,enable=${{ inputs.r-version == '4.1' }}
type=ref,event=branch,suffix=-R${{ inputs.r-version }}
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=semver,pattern={{version}},enable=${{ inputs.r-version == '4.1' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ inputs.r-version == '4.1' }}
type=semver,pattern={{major}},enable=${{ inputs.r-version == '4.1' }}
type=semver,pattern={{version}},suffix=-R${{ inputs.r-version }}
# setup docker build
- name: Set up QEMU
Expand Down
31 changes: 28 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ on:
- 4.3
- 4.4
- devel

schedule:
# 1:30 AM UTC, different R version each day
- cron: '30 1 * * 1' # Rdevel
- cron: '30 1 * * 2' # R4.4
- cron: '30 1 * * 3' # R4.3
- cron: '30 1 * * 4' # R4.2
- cron: '30 1 * * 5' # R4.1

jobs:
# ----------------------------------------------------------------------
Expand All @@ -35,9 +41,28 @@ jobs:
rversion:
runs-on: ubuntu-latest
steps:
- run: echo "null"
- id: mon
if: github.event.schedule == '30 1 * * 1'
run: echo "R_VERSION=devel" >> "$GITHUB_OUTPUT"
- id: tue
if: github.event.schedule == '30 1 * * 2'
run: echo "R_VERSION=4.4" >> "$GITHUB_OUTPUT"
- id: wed
if: github.event.schedule == '30 1 * * 3'
run: echo "R_VERSION=4.3" >> "$GITHUB_OUTPUT"
- id: thu
if: github.event.schedule == '30 1 * * 4'
run: echo "R_VERSION=4.2" >> "$GITHUB_OUTPUT"
- id: fri
if: github.event.schedule == '30 1 * * 5'
run: echo "R_VERSION=4.1" >> "$GITHUB_OUTPUT"
- id: default
if: github.event_name != 'schedule'
run: echo "R_VERSION=${{ github.event.inputs.r_version || '4.1' }}" >> "$GITHUB_OUTPUT"
outputs:
R_VERSION: ${{ github.event.inputs.r_version || '4.1' }}
# Note: "steps.*" seems to mean "all step ids", not "all steps"
# If seeing weird results here, check that all steps above have an id set.
R_VERSION: ${{ join(steps.*.outputs.R_VERSION, '') }}

# ----------------------------------------------------------------------
# depends image has all the dependencies installed
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/download-met-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

container:
image: pecan/depends:R4.1
image: pecan/depends:develop-R4.1

steps:
# checkout source code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sipnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

container:
image: pecan/depends:R${{ inputs.R-version }}
image: pecan/depends:develop-R${{ inputs.R-version }}

steps:
# checkout source code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

container:
image: pecan/depends:R${{ inputs.R-version }}
image: pecan/depends:develop-R${{ inputs.R-version }}

steps:
# checkout source code
Expand Down
36 changes: 19 additions & 17 deletions models/linkages/R/model2netcdf.LINKAGES.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
model2netcdf.LINKAGES <- function(outdir, sitelat, sitelon, start_date = NULL,
end_date = NULL, pft_names = NULL) {
# , PFTs) { logger.severe('NOT IMPLEMENTED')


## Create a new enviroment
linkages_env <- new.env()
### Read in model output in linkages format
load(file.path(outdir, "linkages.out.Rdata"))
load(file.path(outdir, "linkages.out.Rdata"),envir = linkages_env)
# linkages.output.dims <- dim(linkages.output)

### Determine number of years and output timestep
Expand Down Expand Up @@ -47,21 +49,21 @@ model2netcdf.LINKAGES <- function(outdir, sitelat, sitelon, start_date = NULL,
## Setup outputs for netCDF file in appropriate units
output <- list()
## standard variables: Carbon Pools
output[[1]] <- ag.biomass[y, ] # Above Ground Biomass in kgC/m2
output[[2]] <- ag.biomass[y, ] # Total Live Biomass in kgC/m2 (no distinction from AGB in linkages)
output[[3]] <- total.soil.carbon[y, ] # TotSoilCarb in kgC/m2
output[[4]] <- c(ag.biomass[y, ], total.soil.carbon[y, ], leaf.litter[y, ], area[y, ]) # Carb Pools in kgC/m2
output[[1]] <- linkages_env$ag.biomass[y, ] # Above Ground Biomass in kgC/m2
output[[2]] <- linkages_env$ag.biomass[y, ] # Total Live Biomass in kgC/m2 (no distinction from AGB in linkages)
output[[3]] <- linkages_env$total.soil.carbon[y, ] # TotSoilCarb in kgC/m2
output[[4]] <- c(linkages_env$ag.biomass[y, ], linkages_env$total.soil.carbon[y, ], linkages_env$leaf.litter[y, ], linkages_env$area[y, ]) # Carb Pools in kgC/m2
output[[5]] <- c("AGB", "Soil Organic Matter", "Leaf Litter", "LAI") # poolname
output[[6]] <- ag.npp[y, ] # GWBI = NPP in linkages
output[[7]] <- hetero.resp[y, ] # HeteroResp in kgC/m^2/s
output[[8]] <- ag.npp[y, ] # NPP = GWBI in linkages
output[[9]] <- nee[y, ] # NEE #possibly questionable
output[[10]] <- et[y, ] # Evap in kg/m^2/s
output[[11]] <- agb.pft[, y, ]
output[[12]] <- f.comp[, y]
output[[13]] <- area[y, ] #LAI
output[[14]] <- water[y, ] #soil moisture
output[[15]] <- abvgroundwood.biomass[y,] #AbvGroundWood just wood no leaves
output[[6]] <- linkages_env$ag.npp[y, ] # GWBI = NPP in linkages
output[[7]] <- linkages_env$hetero.resp[y, ] # HeteroResp in kgC/m^2/s
output[[8]] <- linkages_env$ag.npp[y, ] # NPP = GWBI in linkages
output[[9]] <- linkages_env$nee[y, ] # NEE #possibly questionable
output[[10]] <- linkages_env$et[y, ] # Evap in kg/m^2/s
output[[11]] <- linkages_env$agb.pft[, y, ]
output[[12]] <- linkages_env$f.comp[, y]
output[[13]] <- linkages_env$area[y, ] #LAI
output[[14]] <- linkages_env$water[y, ] #soil moisture
output[[15]] <- linkages_env$abvgroundwood.biomass[y,] #AbvGroundWood just wood no leaves
output[[16]] <- seq_along(pft_names)

# ******************** Declare netCDF variables ********************#
Expand All @@ -75,7 +77,7 @@ model2netcdf.LINKAGES <- function(outdir, sitelat, sitelon, start_date = NULL,
dim.cpools <- ncdf4::ncdim_def("cpools", "", vals = 1:4, longname = "Carbon Pools")
dim.cpools1 <- ncdf4::ncdim_def("cpools", "", vals = 1:4, longname = "Carbon Pools", create_dimvar = FALSE)
#dim.pfts <- ncdim_def("pfts", "", vals = 1:nrow(agb.pft), longname = "PFTs", create_dimvar = FALSE)
dim.pfts <- ncdf4::ncdim_def(name = "pft", units = "unitless", vals = 1:length(agb.pft[, 1, 1]), longname = "Plant Functional Type", unlim = TRUE)
dim.pfts <- ncdf4::ncdim_def(name = "pft", units = "unitless", vals = 1:length(linkages_env$agb.pft[, 1, 1]), longname = "Plant Functional Type", unlim = TRUE)


for (i in seq_along(output)) {
Expand Down
19 changes: 12 additions & 7 deletions models/linkages/R/write_restart.LINKAGES.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,21 @@ write_restart.LINKAGES <- function(outdir, runid, start.time, stop.time,
}
print(paste0("runid = ", runid))

# Create a new enviroment
linkages_env <- new.env()
# load output
load(outfile)
load(outfile, envir = linkages_env)

ntrees <- ntrees.kill[, ncol(ntrees.kill), 1] # number of trees
ntrees <- linkages_env$ntrees.kill[, ncol(linkages_env$ntrees.kill), 1] # number of trees

if(sum(ntrees)==0) {
#reloads spin up if theres nothing in the output file
print('No survivors. Reusing spinup.')
load(file.path(outdir, runid,list.files(file.path(outdir, runid))[grep(list.files(file.path(outdir, runid)),pattern='linkages')][1]))
ntrees <- ntrees.kill[, ncol(ntrees.kill), 1] # number of trees
# new enviroment for spin up data
linkages_env_spinup <- new.env()
spinup_file <- file.path(outdir, runid,list.files(file.path(outdir, runid))[grep(list.files(file.path(outdir, runid)),pattern='linkages')][1])
load(spinup_file, envir = linkages_env_spinup)
ntrees <- linkages_env_spinup$ntrees.kill[, ncol(linkages_env_spinup$ntrees.kill), 1] # number of trees

}

Expand All @@ -152,11 +157,11 @@ write_restart.LINKAGES <- function(outdir, runid, start.time, stop.time,
tyl <- tyl
C.mat <- C.mat

nogro <- as.vector(nogro.save[, ncol(nogro.save), 1]) ## no growth indicator
nogro <- as.vector(linkages_env$nogro.save[, ncol(linkages_env$nogro.save), 1]) ## no growth indicator
ksprt <- matrix(0, 1, nspec) ## kill sprout indicator ## LOOK INTO THIS
iage <- as.vector(iage.save[, ncol(iage.save), 1]) # individual age
iage <- as.vector(linkages_env$iage.save[, ncol(linkages_env$iage.save), 1]) # individual age

dbh <- as.vector(dbh.save[, ncol(dbh.save), 1])
dbh <- as.vector(linkages_env$dbh.save[, ncol(linkages_env$dbh.save), 1])

n.index <- c(rep(1, ntrees[1]))
for (i in 2:length(settings$pfts)) {
Expand Down
32 changes: 1 addition & 31 deletions models/linkages/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,7 @@ Suggests or Enhances not in mainstream repositories:
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
model2netcdf.LINKAGES: no visible binding for global variable
‘ag.biomass’
model2netcdf.LINKAGES: no visible binding for global variable
‘total.soil.carbon’
model2netcdf.LINKAGES: no visible binding for global variable
‘leaf.litter’
model2netcdf.LINKAGES: no visible binding for global variable ‘area’
model2netcdf.LINKAGES: no visible binding for global variable ‘ag.npp’
model2netcdf.LINKAGES: no visible binding for global variable
‘hetero.resp’
model2netcdf.LINKAGES: no visible binding for global variable ‘nee’
model2netcdf.LINKAGES: no visible binding for global variable ‘et’
model2netcdf.LINKAGES: no visible binding for global variable ‘agb.pft’
model2netcdf.LINKAGES: no visible binding for global variable ‘f.comp’
model2netcdf.LINKAGES: no visible binding for global variable ‘water’
model2netcdf.LINKAGES: no visible binding for global variable
‘abvgroundwood.biomass’
write_restart.LINKAGES: no visible binding for global variable
‘ntrees.kill’
write_restart.LINKAGES: no visible binding for global variable
‘nogro.save’
write_restart.LINKAGES: no visible binding for global variable
‘iage.save’
write_restart.LINKAGES: no visible binding for global variable
‘dbh.save’
Undefined global functions or variables:
abvgroundwood.biomass ag.biomass ag.npp agb.pft area
db.close db.open db.query dbh.save et f.comp
hetero.resp iage.save leaf.litter nee nogro.save
ntrees.kill total.soil.carbon water
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
Expand Down
10 changes: 7 additions & 3 deletions modules/benchmark/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@ Title: PEcAn Functions Used for Benchmarking
Version: 1.7.3.9000
Authors@R: c(person("Mike", "Dietze", role = c("aut", "cre"),
email = "dietze@bu.edu"),
person("Betsy", "Cowdery", role = c("aut"),
email = "emcowdery@gmail.com"),
person("David", "LeBauer", role = c("aut"),
email = "dlebauer@email.arizona.edu"),
email = "dlebauer@gmail.com"),
person("Rob", "Kooper", role = c("aut"),
email = "kooper@illinois.edu"),
person("Toni", "Viskari", role = c("aut")),
person("University of Illinois, NCSA", role = c("cph")))
Author: Michael Dietze, David LeBauer, Rob Kooper, Toni Viskari
Author: Michael Dietze, Betsy Cowdery, David LeBauer, Rob Kooper, Toni Viskari
Maintainer: Mike Dietze <dietze@bu.edu>
Description: The Predictive Ecosystem Carbon Analyzer (PEcAn) is a scientific
workflow management tool that is designed to simplify the management of
model parameterization, execution, and analysis. The goal of PEcAn is to
streamline the interaction between data and models, and to improve the
efficacy of scientific investigation.
efficacy of scientific investigation. The PEcAn.benchmark package provides
utilities for comparing models and data, including a suite of statistical
metrics and plots.
Imports:
dplyr,
ggplot2,
Expand Down

0 comments on commit 113e39a

Please sign in to comment.