PredictiveEcology / CBM_core

Other
0 stars 1 forks source link

CO2 comes out as NAs out of the c++ step function #4

Closed cboisvenue closed 3 years ago

cboisvenue commented 4 years ago

CH4, and CO pools get contributions during fires, but CO2 seems to be reset as NAs. All three gases are NAs is the sim$pools NAs are not set to 0.

cboisvenue commented 3 years ago

The problem was on the R-code side. Values were being set back to zero before being saved into $cbmPools. Yearly emissions and Products are now calculated by differences between values CO2, CH4, CO and Products before carbon transactions are applied (emissionsProductsIn) and after the transactions (emissionsProductsOut). There was also an assertion added that checks that the values in the first year are the first values added to $cbmPools.