GCBM
|
#include <cbmlandclasstransitionmodule.h>
Public Member Functions | |
CBMLandClassTransitionModule () | |
virtual | ~CBMLandClassTransitionModule ()=default |
void | configure (const DynamicObject &config) override |
void | subscribe (NotificationCenter ¬ificationCenter) override |
flint::ModuleTypes | moduleType () |
virtual void | doLocalDomainInit () override |
virtual void | doTimingInit () override |
virtual void | doTimingStep () override |
Public Member Functions inherited from CBMModuleBase | |
virtual | ~CBMModuleBase ()=default |
void | onSystemInit () override |
void | onSystemShutdown () override |
void | onLocalDomainInit () override |
void | onLocalDomainShutdown () override |
void | onLocalDomainProcessingUnitInit () override |
void | onLocalDomainProcessingUnitShutdown () override |
void | onPreTimingSequence () override |
void | onTimingInit () override |
void | onTimingPrePostInit () override |
void | onTimingPostInit () override |
void | onTimingPostInit2 () override |
void | onTimingShutdown () override |
void | onTimingStep () override |
void | onTimingPreEndStep () override |
void | onTimingEndStep () override |
void | onTimingPostStep () override |
void | onOutputStep () override |
void | onPrePostDisturbanceEvent () override |
void | onPostDisturbanceEvent () override |
void | onPostDisturbanceEvent2 () override |
void | onError (std::string msg) override |
void | onDisturbanceEvent (DynamicVar e) override |
void | onPostNotification (short preMessageSignal) override |
virtual void | doSystemInit () |
virtual void | doSystemShutdown () |
virtual void | doLocalDomainShutdown () |
virtual void | doLocalDomainProcessingUnitInit () |
virtual void | doLocalDomainProcessingUnitShutdown () |
virtual void | doPreTimingSequence () |
virtual void | doTimingPrePostInit () |
virtual void | doTimingPostInit () |
virtual void | doTimingPostInit2 () |
virtual void | doTimingShutdown () |
virtual void | doTimingPreEndStep () |
virtual void | doTimingEndStep () |
virtual void | doTimingPostStep () |
virtual void | doOutputStep () |
virtual void | doError (std::string msg) |
virtual void | doDisturbanceEvent (DynamicVar) |
virtual void | doPrePostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent2 () |
virtual void | doPostNotification (short preMessageSignal) |
Private Member Functions | |
void | updateRemainingStatus (std::string landClass) |
void | setUnfcccLandClass () |
void | fetchLandClassTransitions () |
std::string | getCreationDisturbance () |
Private Attributes | |
flint::IVariable * | _historicLandClass |
flint::IVariable * | _currentLandClass |
flint::IVariable * | _unfcccLandClass |
flint::IVariable * | _isForest |
flint::IVariable * | _lastPassDisturbance |
flint::IVariable * | _isDecaying |
flint::IVariable * | _lastPassDisturbanceTimeseries = nullptr |
std::unordered_map< std::string, bool > | _landClassForestStatus |
std::unordered_map< std::string, int > | _landClassElapsedTime |
std::unordered_map< std::string, std::string > | _landClassTransitions |
std::string | _lastCurrentLandClass |
int | _yearsSinceTransition = 0 |
|
virtualdefault |
|
override |
Configuration function.
config | DynamicObject& |
|
overridevirtual |
Initialise a constant variable landClasses as land_class_data variable value.
If landClasses is a vector, Initialise a constant variable allTransistions as landClasses (vector<DynamicObject>).
For each constant variable row in allTransistions, assign CBMLandClassTransitionModule._landClassForestStatus[row["land_class"]] as row["is_forest"] and
CBMLandClassTransitionModule._landClassElapsedTime[row["land_class"]] as row["years_to_permanent"].
If not, assign CBMLandClassTransitionModule._landClassForestStatus[landClasses["land_class"]] as landClasses["is_forest"] and
CBMLandClassTransitionModule._landClassElapsedTime[landClasses["land_class"]] as landClasses["years_to_permanent"].
Initialise CBMLandClassTransitionModule._isForest,CBMLandClassTransitionModule._isDecaying,CBMLandClassTransitionModule._historicLandClass,
CBMLandClassTransitionModule._currentLandClass and CBMLandClassTransitionModule._unfcccLandClass.
if _landUnitData has variable last_pass_disturbance_timeseries, initialise CBMLandClassTransitionModule._lastPassDisturbanceTimeseries.
Invoke fetchLandClassTransitions().
Reimplemented from CBMModuleBase.
|
overridevirtual |
Set initial decay status
Assign CBMLandClassTransitionModule._lastCurrentLandClass as CBMLandClassTransitionModule._currentLandClass value (string).
Invoke CBMLandClassTransitionModule.setUnfcccLandClass(), set CBMLandClassTransitionModule._yearsSinceTransition to 0
Set the initial stand decaying status. The carbon in a stand always decays unless the stand is initially a non-forest land class and the last-pass disturbance was not a deforestation event - i.e. a non-forest stand that will be afforested at some point has its decay paused until then
If the value of CBMLandClassTransitionModule._isForest is false and land was deforested in spinup, then set CBMLandClassTransitionModule._isDecaying to false, else set it to true
Reimplemented from CBMModuleBase.
|
overridevirtual |
Iterate CBMLandClassTransitionModule.yearsSinceTransition by 1;
Initialise string varaible currentLandClass as CBMLandClassTransitionModule._currentLandClass value.
if currentLandClass is equal to CBMLandClassTransitionModule._lastCurrentLandClass, invoke updateRemainigStatus() using currentLandClass as a parameter and
End program.
Assign CBMLandClassTransitionModule._historicLandClass as CBMLandClassTransitionModule._landCurrentLandClass.
Assign CBMLandClassTransitionModule._lastCurrentLandClass as currentLandClass.
Invoke CBMLandClassTransitionModule.setUnfcccLandClass();
Assign CBMLandClassTransitionModule._yearsSinceTransition as 0.
Set CBMLandClassTransitionModule._isDecaying to true.
Reimplemented from CBMModuleBase.
|
private |
Insert the values of "disturbance_type" and "land_class_transition" as a pair in "land_class_transitions" from variable _landUnitData into CBMLandClassTransitionModule._landClassTransitions
|
private |
If CBMLandClassTransitionModule._lastPassDisturbanceTimeseries is not equal to nullptr,
initialise constant variable lastPassTimeseries as CBMLandClassTransitionModule._lastPassDisturbanceTimeSeries value.
if lastPassTimeseries is not empty, initialise integer variable maxYear as -1.
Initialise string variable creationDisturbance.
For each constant variable event in lastPassTimeseries (vector<DynamicObject>),
initalise integer variable year as event["year"].
if year is greater than maxYear, assign maxYear as year and creationDisturbance as event["disturbance_type"] (string)
return creationDisturbance.
else, initialise a constant variable spinup as spinup_parameters value and spinupParams as spinup (DynamicObject).
return spinupParams["last_pass_disturbance_type"](string).
flint::ModuleTypes moduleType | ( | ) |
|
private |
Assign string variable currentLandClass as CBMLandClassTransitionModule._currentLandClass,
CBMLandClassTransitionModule._isForest as CBMLandClassTransitionModule._landClassForestStatus[currentLandClass]
, CBMLandClassTransitionModule._unfcccLandClass based on CBMLandClassTransitionModule._historicLandClass
and currentLandClass
|
override |
Subscribe to the signals LocalDomainInit, TimingInit and TimingStep.
notificationCenter | NotificationCenter& |
|
private |
If the parameter landClass is the same as CBMLandClassTransitionModule._historicLandClass, return
If the value of parameter landClass CBMLandClassTransitionModule._landClassElapsedTime is > CBMLandClassTransitionModule.targetYears, set the value of _historicLandClass to landClass and invoke CBMLandClassTransitionModule.setUnfcccLandClass()
landClass | string |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |