Skip to content

Commit

Permalink
Merge pull request #337 from DrylandEcology/feature_vegestab
Browse files Browse the repository at this point in the history
Resurrect "vegetation establishment"

Functionality to calculate and output establishment/recruitment of species now works again and is now covered by tests (issue #336, @dschlaep). Note that this functionality assesses yearly the chances of species to recruit/establish based on simulated daily conditions; however, establishment/recruitment outcomes are not utilized to inform the simulation.

- The functionality is activated by

  1. activating it in "Inputs/estab.in"; default is 0 ("off")
  2. listing at least one species input file with establishment parameters (default includes "bouteloua.estab" and "bromus.estab")
  3. providing the listed species input files with establishment parameters (defaults include "bouteloua.estab" and "bromus.estab")
  4. turning on output for key "ESTABL" in "Inputs/outsetup.in"; default is "off"
  • Loading branch information
dschlaep authored Jan 13, 2023
2 parents 436bfeb + b2cf0f8 commit 0a11f71
Show file tree
Hide file tree
Showing 11 changed files with 265 additions and 88 deletions.
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# SOILWAT2 v6.7.0
* This version produces exactly the same simulation output
as the previous release under default values
(i.e., vegetation establishment is turned off).

* Functionality to calculate and output establishment/recruitment of species
now works again and is now covered by tests (issue #336, @dschlaep).
Note that this functionality assesses yearly the chances of
species to recruit/establish based on simulated daily conditions;
however, establishment/recruitment outcomes are not utilized to inform the
simulation.

## Changes to inputs
* New input via `"<species>.estab"` sets the vegetation type of
a species establishment parameters'.


# SOILWAT2 v6.6.0
* Random number generators now produce sequences that can be exactly reproduced.
Expand Down
2 changes: 1 addition & 1 deletion SW_Control.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void SW_CTL_init_run(void) {
SW_PET_init_run();
SW_SKY_init_run();
SW_SIT_init_run();
// SW_VES_init_run() not needed
SW_VES_init_run(); // must run after `SW_SIT_init_run()`
SW_VPD_init_run();
SW_FLW_init_run();
SW_ST_init_run();
Expand Down
2 changes: 2 additions & 0 deletions SW_Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#ifndef SW_CONTROL_H
#define SW_CONTROL_H

#include "generic.h" // for `Bool`, `swTRUE`, `swFALSE`

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
17 changes: 7 additions & 10 deletions SW_Output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1946,8 +1946,7 @@ void SW_OUT_new_year(void)



int SW_OUT_read_onekey(OutKey k, OutSum sumtype, char period[], int first,
int last, char msg[])
int SW_OUT_read_onekey(OutKey k, OutSum sumtype, int first, int last, char msg[])
{
int res = 0; // return value indicating type of message if any

Expand Down Expand Up @@ -1987,11 +1986,6 @@ int SW_OUT_read_onekey(OutKey k, OutSum sumtype, char period[], int first,
SW_Output[k].sumtype = eSW_Sum;
first = 1;
last = 366;
#ifndef RSOILWAT
strcpy(period, "YR");
#else
if (period) {} // avoid `-Wunused-parameter`
#endif

} else if ((k == eSW_AllVeg || k == eSW_ET || k == eSW_AllWthr || k == eSW_AllH2O))
{
Expand Down Expand Up @@ -2159,10 +2153,13 @@ void SW_OUT_read(void)
#endif

// Fill information into `SW_Output[k]`
msg_type = SW_OUT_read_onekey(k,
msg_type = SW_OUT_read_onekey(
k,
str2stype(Str_ToUpper(sumtype, upsum)),
period, first, !Str_CompareI("END", (char *)last) ? 366 : atoi(last),
msg);
first,
!Str_CompareI("END", (char *)last) ? 366 : atoi(last),
msg
);

if (msg_type != 0) {
if (msg_type > 0) {
Expand Down
3 changes: 1 addition & 2 deletions SW_Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ void SW_OUT_deconstruct(Bool full_reset);
void SW_OUT_set_ncol(void);
void SW_OUT_set_colnames(void);
void SW_OUT_new_year(void);
int SW_OUT_read_onekey(OutKey k, OutSum sumtype, char period[], int first,
int last, char msg[]);
int SW_OUT_read_onekey(OutKey k, OutSum sumtype, int first, int last, char msg[]);
void SW_OUT_read(void);
void SW_OUT_sum_today(ObjType otyp);
void SW_OUT_write_today(void);
Expand Down
Loading

0 comments on commit 0a11f71

Please sign in to comment.