Skip to content

Commit

Permalink
bugfix: ModvegeParameters$set_parameters() can handle empty lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuadrat committed Aug 8, 2024
1 parent 6547353 commit 32a4ec3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: growR
Type: Package
Version: 1.3.0.9002
Version: 1.3.0.9003
Date: 2024-05-23
Authors@R: person(
given = "Kevin",
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
* site_name and run_name are printed to console in `growR_run_loop`.
* PhenologicalAutocut
* Multithreading for `growR_run_loop` with the `parallel` package.
* New parameter for irrigation.

## Changed

* autocut algorithm is now outsourced to its own R6class.
* Performance improvements to ModvegeSite$un() in the order of 25%.

## Fixed

* `ModvegeParameters$set_parameters()` can now handle empty lists.

## Removed

* `ModvegeParameters$senescence_cap`
Expand Down
5 changes: 5 additions & 0 deletions R/parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,11 @@ ModvegeParameters = R6Class(
#'
set_parameters = function(params) {
param_names = names(params)
# Handle the case of an empty list.
if (length(params) == 0) {
return()
}

for (i in 1:length(params)) {
name = param_names[[i]]
self[[name]] = params[[i]]
Expand Down

0 comments on commit 32a4ec3

Please sign in to comment.