Skip to content

Commit

Permalink
Merge branch 'cjson_files_default' into 'master'
Browse files Browse the repository at this point in the history
add support for new cjson files with new arg to write_config - cjson_filename....

See merge request lpjml/lpjmlkit!85
  • Loading branch information
stephnwirth committed Dec 5, 2023
2 parents 13e6353 + 7171303 commit fe178fd
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '2362200'
ValidationKey: '2560480'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
gamstransfer=?ignore
any::lucode2
any::covr
any::madrat
Expand Down Expand Up @@ -56,6 +57,8 @@ jobs:
- name: Test coverage
shell: Rscript {0}
run: covr::codecov(quiet = FALSE)
run: |
nonDummyTests <- setdiff(list.files("./tests/testthat/"), c("test-dummy.R", "_snaps"))
if(length(nonDummyTests) > 0) covr::codecov(quiet = FALSE)
env:
NOT_CRAN: "true"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exclude: '^tests/testthat/_snaps/.*$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-case-conflict
- id: check-json
Expand All @@ -15,7 +15,7 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/lorenzwalthert/precommit
rev: v0.3.2.9019
rev: v0.3.2.9025
hooks:
- id: parsable-R
- id: deps-in-desc
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'lpjmlkit: Toolkit for Basic LPJmL Handling'
version: 1.2.0
date-released: '2023-11-24'
version: 1.3.0
date-released: '2023-12-05'
abstract: A collection of basic functions to facilitate the work with the Dynamic
Global Vegetation Model (DGVM) Lund-Potsdam-Jena managed Land (LPJmL) hosted at
the Potsdam Institute for Climate Impact Research (PIK). It provides functions for
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: lpjmlkit
Type: Package
Title: Toolkit for Basic LPJmL Handling
Version: 1.2.0
Version: 1.3.0
Authors@R: c(
person("Jannes", "Breier", , "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9055-6904")),
person("Sebastian","Ostberg", , "[email protected]", role = "aut", comment = c(ORCID = "0000-0002-2368-7015")),
Expand Down Expand Up @@ -54,4 +54,4 @@ Suggests:
sf
Config/testthat/edition: 3
VignetteBuilder: knitr
Date: 2023-11-24
Date: 2023-12-05
6 changes: 3 additions & 3 deletions R/read_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ read_config <- function(filename,
if (tolower(file_type) == "json") {
tmp_json <- jsonlite::read_json(path = filename, simplify = FALSE)

# Read compilable cjson or js files - the standard default config files. These
# should be detected as "text" by detect_io_type.
} else {
# Read compilable cjson or js files - the standard default config files. These
# should be detected as "text" by detect_io_type.
tmp_json <- parse_config(
path = dirname(filename),
js_filename = basename(filename),
cjson_filename = basename(filename),
from_restart = from_restart,
macro = macro
)
Expand Down
7 changes: 5 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Collection of small utility function applied across the package

# Function to deprecate a function argument that is replaced by a new one
deprecate_arg <- function(new_arg, deprec_arg, version = "1.0.0") {
deprecate_arg <- function(new_arg,
deprec_arg,
version = "1.0.0",
ignore_new_arg = FALSE) {

new_name <- deparse(substitute(new_arg))
deprec_name <- deparse(substitute(deprec_arg))

# Only if deprecated argument is set
if (!is.null(deprec_arg)) {

if (is.null(new_arg)) {
if (is.null(new_arg) || ignore_new_arg) {
new_arg <- deprec_arg

} else {
Expand Down
Loading

0 comments on commit fe178fd

Please sign in to comment.