Skip to content

Commit 85a136b

Browse files
cami-webbCameron WebbAlomir
authored
Add woodCreation as output (#161)
* Add woodCreation as output * Update src/sipnet/sipnet.c Co-authored-by: Mike Longfritz <Mike.Longfritz@gmail.com> * Updates to print mis-matched column info * Fixes for linter * Fixes (again) for linter --------- Co-authored-by: Cameron Webb <cwebb16@scc1.bu.edu> Co-authored-by: Mike Longfritz <Mike.Longfritz@gmail.com>
1 parent 3035883 commit 85a136b

7 files changed

Lines changed: 22805 additions & 22788 deletions

File tree

src/sipnet/sipnet.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void readParamData(ModelParams **modelParamsPtr, const char *paramFile) {
398398
void outputHeader(FILE *out) {
399399
fprintf(out, "Notes: (PlantWoodC, PlantLeafC, Soil and Litter in g C/m^2; "
400400
"Water and Snow in cm; SoilWetness is fraction of WHC;\n");
401-
fprintf(out, "year day time plantWoodC plantLeafC ");
401+
fprintf(out, "year day time plantWoodC plantLeafC woodCreation ");
402402
fprintf(out, "soil microbeC coarseRootC fineRootC ");
403403
fprintf(out, "litter soilWater soilWetnessFrac snow ");
404404
fprintf(out, "npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot "
@@ -414,8 +414,8 @@ void outputHeader(FILE *out) {
414414
*/
415415
void outputState(FILE *out, int year, int day, double time) {
416416

417-
fprintf(out, "%4d %3d %5.2f %8.2f %8.2f ", year, day, time, envi.plantWoodC,
418-
envi.plantLeafC);
417+
fprintf(out, "%4d %3d %5.2f %8.2f %8.2f %8.2f ", year, day, time,
418+
envi.plantWoodC, envi.plantLeafC, trackers.woodCreation);
419419
fprintf(out, "%8.2f ", envi.soil);
420420
fprintf(out, "%8.2f ", envi.microbeC);
421421
fprintf(out, "%8.2f %8.2f", envi.coarseRootC, envi.fineRootC);
@@ -1285,6 +1285,7 @@ void initTrackers(void) {
12851285
trackers.evapotranspiration = 0.0;
12861286
trackers.soilWetnessFrac = envi.soilWater / params.soilWHC;
12871287
trackers.rSoil = 0.0;
1288+
trackers.woodCreation = 0.0;
12881289

12891290
trackers.rRoot = 0.0;
12901291

@@ -1382,6 +1383,7 @@ void updateTrackers(double oldSoilWater) {
13821383
trackers.totRtot += trackers.rtot;
13831384
trackers.totNpp += trackers.npp;
13841385
trackers.totNee += trackers.nee;
1386+
trackers.woodCreation = fluxes.woodCreation * climate->length;
13851387

13861388
// evapotranspiration includes water lost to evaporation from canopy
13871389
// irrigation (fluxes.eventEvap)

src/sipnet/state.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,10 @@ typedef struct TrackerVars { // variables to track various things
576576
double rAboveground;
577577
// g C * m^-2 litterfall, year to date: SUM litter
578578
double yearlyLitter;
579+
580+
// g C * m^-2 wood creation
581+
double woodCreation;
582+
579583
} Trackers;
580584

581585
// Global var

tests/smoke/niwot/sipnet.out

Lines changed: 5237 additions & 5237 deletions
Large diffs are not rendered by default.

tests/smoke/russell_1/sipnet.out

Lines changed: 5849 additions & 5849 deletions
Large diffs are not rendered by default.

tests/smoke/russell_3/sipnet.out

Lines changed: 5849 additions & 5849 deletions
Large diffs are not rendered by default.

tests/smoke/russell_4/sipnet.out

Lines changed: 5849 additions & 5849 deletions
Large diffs are not rendered by default.

tools/smoke_check.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,23 @@ def check_results(smoke_dir: str, verbose: bool):
124124
git_df = pd.read_table(git_result, skiprows=1, header=0, sep=r'\s+', dtype=float)
125125

126126
if set(new_df.columns) != set(git_df.columns):
127-
print("Columns have changed! Comparing subset of matching columns")
127+
print("Columns have changed!")
128128
common_columns = [col for col in new_df.columns if col in git_df.columns]
129+
git_inter_columns = [col for col in git_df.columns if col not in new_df.columns]
130+
new_inter_columns = [col for col in new_df.columns if col not in git_df.columns]
129131
# common_columns = list(set(new_df.columns) & set(git_df.columns))
132+
if git_inter_columns:
133+
print(f"Removed columns from git: {git_inter_columns}")
134+
else:
135+
print("No columns removed")
136+
if new_inter_columns:
137+
print(f"New columns: {new_inter_columns}")
138+
else:
139+
print("No new columns added")
130140
print(f"Common columns: {common_columns}")
131141
new_df = new_df[common_columns]
132142
git_df = git_df[common_columns]
143+
print("Comparing common columns")
133144
else:
134145
cols = 'year day time plantWoodC plantLeafC soil microbeC coarseRootC fineRootC litter litterWater soilWater soilWetnessFrac snow npp nee cumNEE gpp rAboveground rSoil rRoot ra rh rtot evapotranspiration fluxestranspiration fPAR'
135146
cols = cols.split(' ')

0 commit comments

Comments
 (0)