Skip to content

Commit

Permalink
Merge branch 'PecanProject:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DongchenZ authored Sep 30, 2024
2 parents 76f2b72 + 89709f9 commit 9fa90a8
Show file tree
Hide file tree
Showing 134 changed files with 1,105 additions and 1,379 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/download-met-data.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name : Test Data Download
on :
# allow manual triggering
workflow_dispatch:

schedule:
# run Thursday 4:30 AM UTC
- cron: '30 4 * * 4'

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2
PGHOST: postgres
CI: true

jobs:
met-data-download:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

services:
postgres:
image: mdillon/postgis:9.5
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

container:
image: pecan/depends:R4.1

steps:
# checkout source code
- name: work around https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/checkout@v4
with:
set-safe-directory: false

# install additional tools needed
- name: install utils
run: apt-get update && apt-get install -y postgresql-client qpdf
- name: install new dependencies
run: Rscript scripts/generate_dependencies.R && cd docker/depends && Rscript pecan.depends.R

# initialize database
- name: db setup
uses: docker://pecan/db:ci
- name: add models to db
run: ./scripts/add.models.sh

# compile PEcAn code
- name: build
run: make -j1

- name: CRUNCEP
run: |
Rscript ./tests/test_met_downloads.R --settings ./tests/met_download_settings/docker.CRUNCEP.xml
6 changes: 3 additions & 3 deletions Makefile.depends
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ $(call depends,models/fates): | .install/base/logger .install/base/remote .insta
$(call depends,models/gday): | .install/base/logger .install/base/remote .install/base/utils
$(call depends,models/jules): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere
$(call depends,models/ldndc): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere .install/modules/data.land
$(call depends,models/linkages): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere
$(call depends,models/linkages): | .install/base/db .install/base/logger .install/base/remote .install/base/utils .install/modules/data.land
$(call depends,models/lpjguess): | .install/base/logger .install/base/remote .install/base/utils
$(call depends,models/maat): | .install/base/logger .install/base/remote .install/base/settings .install/base/utils .install/modules/data.atmosphere
$(call depends,models/maespa): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere
$(call depends,models/preles): | .install/base/logger .install/base/utils .install/modules/data.atmosphere
$(call depends,models/sibcasa): | .install/base/logger .install/base/utils
$(call depends,models/sipnet): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere
$(call depends,models/sibcasa): | .install/base/logger
$(call depends,models/sipnet): | .install/base/logger .install/base/remote .install/base/utils .install/modules/data.atmosphere .install/modules/data.land
$(call depends,models/stics): | .install/base/logger .install/base/remote .install/base/settings .install/base/utils
$(call depends,models/template): | .install/base/db .install/base/logger .install/base/utils
$(call depends,modules/allometry): | .install/base/db
Expand Down
28 changes: 14 additions & 14 deletions base/db/R/dbfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ dbfile.input.insert <- function(in.path, in.prefix, siteid, startdate, enddate,


# setup parent part of query if specified
if (is.na(parentid)) {
parent <- ""
} else {
parent <- ""
if (!is.na(parentid)) {
parent <- paste0(" AND parent_id=", parentid)
}

Expand Down Expand Up @@ -242,13 +241,13 @@ dbfile.input.check <- function(siteid, startdate = NULL, enddate = NULL, mimetyp
formatid <- get.id(table = "formats", colnames = c("mimetype_id", "name"), values = c(mimetypeid, formatname), con = con)

if (is.null(formatid)) {
invisible(data.frame())
return (invisible(data.frame()))
}

# setup parent part of query if specified
if (is.na(parentid)) {
parent <- ""
} else {
parent <- ""

if (!is.na(parentid)) {
parent <- paste0(" AND parent_id=", parentid)
}

Expand Down Expand Up @@ -450,7 +449,7 @@ dbfile.posterior.check <- function(pft, mimetype, formatname, con, hostname = PE
# find appropriate pft
pftid <- get.id(table = "pfts", values = "name", colnames = pft, con = con)
if (is.null(pftid)) {
invisible(data.frame())
return (invisible(data.frame()))
}

# find appropriate format
Expand All @@ -461,7 +460,7 @@ dbfile.posterior.check <- function(pft, mimetype, formatname, con, hostname = PE
formatid <- get.id(table = "formats", colnames = c("mimetype_id", "name"), values = c(mimetypeid, formatname), con = con)

if (is.null(formatid)) {
invisible(data.frame())
return (invisible(data.frame()))
}

# find appropriate posterior
Expand All @@ -473,7 +472,7 @@ dbfile.posterior.check <- function(pft, mimetype, formatname, con, hostname = PE
con = con
)[["id"]]
if (is.null(posteriorid)) {
invisible(data.frame())
return (invisible(data.frame()))
}

invisible(dbfile.check(type = "Posterior", container.id = posteriorid, con = con, hostname = hostname))
Expand Down Expand Up @@ -639,12 +638,12 @@ dbfile.file <- function(type, id, con, hostname = PEcAn.remote::fqdn()) {

if (nrow(files) > 1) {
PEcAn.logger::logger.warn("multiple files found for", id, "returned; using the first one found")
invisible(file.path(files[1, "file_path"], files[1, "file_name"]))
return(invisible(file.path(files[1, "file_path"], files[1, "file_name"])))
} else if (nrow(files) == 1) {
invisible(file.path(files[1, "file_path"], files[1, "file_name"]))
return(invisible(file.path(files[1, "file_path"], files[1, "file_name"])))
} else {
PEcAn.logger::logger.warn("no files found for ", id, "in database")
invisible(NA)
return(invisible(NA))
}
}

Expand All @@ -662,7 +661,8 @@ dbfile.id <- function(type, file, con, hostname = PEcAn.remote::fqdn()) {
# find appropriate host
hostid <- db.query(query = paste0("SELECT id FROM machines WHERE hostname='", hostname, "'"), con = con)[["id"]]
if (is.null(hostid)) {
invisible(NA)
PEcAn.logger::logger.warn("hostid not found in database")
return (invisible(NA))
}

# find file
Expand Down
3 changes: 1 addition & 2 deletions base/db/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ The Date field is over a month old.
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... NOTE
License stub is invalid DCF.
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
Expand Down
4 changes: 0 additions & 4 deletions base/qaqc/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
* checking package directory ... OK
* checking DESCRIPTION meta-information ... NOTE
Malformed Description field: should contain one or more complete sentences.
Authors@R field gives no person with name and roles.
Authors@R field gives no person with maintainer role, valid email
address and non-empty name.
License stub is invalid DCF.
* checking top-level files ... NOTE
Non-standard file/directory found at top level:
‘README.Rmd’
Expand Down
3 changes: 1 addition & 2 deletions base/remote/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* checking whether package ‘PEcAn.remote’ can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking DESCRIPTION meta-information ... NOTE
License stub is invalid DCF.
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
Expand Down
3 changes: 1 addition & 2 deletions base/settings/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ The Date field is over a month old.
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking DESCRIPTION meta-information ... NOTE
License stub is invalid DCF.
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... NOTE
Non-standard file/directory found at top level:
‘examples’
Expand Down
3 changes: 1 addition & 2 deletions base/visualization/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ The Date field is over a month old.
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking DESCRIPTION meta-information ... NOTE
License stub is invalid DCF.
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
Expand Down
3 changes: 0 additions & 3 deletions base/workflow/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Authors@R: c(person("Mike", "Dietze", role = c("aut"),
person("Shawn", "Serbin", role = c("aut"),
email = "[email protected]"),
person("University of Illinois, NCSA", role = c("cph")))
Author: David LeBauer, Mike Dietze, Xiaohui Feng, Dan Wang,
Mike Dietze, Carl Davidson, Rob Kooper, Shawn Serbin
Maintainer: David LeBauer <[email protected]>
Description: The Predictive Ecosystem Carbon Analyzer
(PEcAn) is a scientific workflow management tool that
is designed to simplify the management of model
Expand Down
10 changes: 1 addition & 9 deletions base/workflow/tests/Rcheck_reference.log
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,7 @@ The Date field is over a month old.
* checking installed package size ... OK
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking DESCRIPTION meta-information ... NOTE
Author field differs from that derived from Authors@R
Author: ‘David LeBauer, Mike Dietze, Xiaohui Feng, Dan Wang, Mike Dietze, Carl Davidson, Rob Kooper, Shawn Serbin’
Authors@R: ‘Mike Dietze [aut], David LeBauer [aut, cre], Xiaohui Feng [aut], Dan Wang [aut], Carl Davidson [aut], Rob Kooper [aut], Shawn Serbin [aut], University of Illinois, NCSA [cph]’

Maintainer field differs from that derived from Authors@R
Maintainer: ‘David LeBauer <[email protected]>’
Authors@R: ‘David LeBauer <[email protected]>’
License stub is invalid DCF.
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
Expand Down
Loading

0 comments on commit 9fa90a8

Please sign in to comment.