Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resurrect "vegetation establishment" #337

Merged
merged 9 commits into from
Jan 13, 2023
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