Storage Tree

Values generated during utility calculation, such as damage, cost etc., are stored in the two derived classes of the abstract class ezclimate.storage_tree.BaseStorageTree namely, ezclimate.storage_tree.SmallStorageTree, and ezclimate.storage_tree.BigStorageTree. The ‘small’ storage tree stores values for every time period where decisions about mitigation are made, and the ‘big’ storage tree stores values for every subinterval period too. The base class defines the method for initializing the dictionary tree were the values are stored. The keys of the dictionary are the time periods in the tree where values are stored. It also defines methods for getting and setting, saving, and information about periods. Moreover, it defines an abstract method get_next_period_array() that needs to be initialized in derived classes.

Small storage tree

In the ezclimate.storage_tree.SmallStorageTree there’s no storage in nodes between periods in decision_times - that needs to be defined when initilizing and object of the class. For example,

import ezclimate.storage_tree as st

sst = st.SmallStorageTree(decision_times=[0, 15, 45, 85, 185, 285, 385])

Hence the sst will have 7 keys in its tree dictionary. To access elements in the tree dictionary, the following is equivalent:

sst.tree[385]
sst[385] # BaseStorageClass defines its own __getitem__

Big storage tree

In the ezclimate.storage_tree.BigStorageTree there’s storage in nodes between periods in decision_times. Besides defining the decision_times when initilizing an object of the class, the user also needs to define the length of the subinterval.

bst = st.BigStorageTree(subinterval_len=5, decision_times=[0, 15, 45, 85, 185, 285, 385])
bst[380] # time period that is not a decision time
bst[385]