PredictiveEcology / CBMutils

Utilities for modelling carbon in R based on CBM-CFS3
0 stars 0 forks source link

CO2 carbon pool is always NA #2

Closed cboisvenue closed 3 years ago

cboisvenue commented 4 years ago

It has to with NAs and emissions pools (CO2, CH4, CO). Right out of the spinup (sim$spinupResults), these columns are all NAs. If I leave them as NAs, they all come out as NAs after a StepPools(c++ fnct), regardless if the pixelGroup is disturbed or not. If I change the NAs for 0s before the a StepPools(c++ fnct), I get carbon values for CH4 and CO but the CO2 column still returns NAs. CO2 values are important emissions, so we need to get them right. The c++ StepPools() fct treats the CO2 column differently. The NAs in these three columns during and post spinup are not important but the StepPools() in our annual event is: these are are fluxes to the atmosphere in CO2 (respiration, decomposition, and fire).

cboisvenue commented 3 years ago

A note: the sim$cbmData@pools object defines SoftwoodMerch as pool id "1". Maybe tracking where it is used in the c++ script can help figure out the confusing pool ids.

cboisvenue commented 3 years ago

The issue was in the re-setting of the out-of-system pools (gases and products). The re-zeroing was done with column numbers instead of names (dangerous) and the time of it was wrong. The fixes were done on CBM_core commit 5359e7f48a122bd64191d7af0b0ebf4a56717178. The CO2, checked with CBMutils::checkTransactions() , are not correct.