ciceroOslo / ciceroscm

Python version of the CICERO-SCM simple climate model/emulator
Apache License 2.0
17 stars 4 forks source link

Alternative carbon pool decay _rs_function with user defined parameters. #101

Closed benmsanderson closed 1 year ago

benmsanderson commented 1 year ago

Define alternative function to be called from concentrations_emissions_handler.py

Remove time condition in _rs_function and allow function to be set by vector of coefficients and decay constants of length n, where n is the number of allowed decay modes.

Something along the lines of this:

rs_C=np.array([0.24278,0.13963,0.089318,0.03782,0.035549])
#Condition 1: elements must be real +ve
#Condition 2: sum of elements must be <=1 

rs_T=np.array([1.2679,5.2528,18.601,68.736,232.3])
#Condition: (all values must be real +ve)

def _rs_new(it, C=rs_C, T=rs_T, idtm=24):
        Co=1-np.sum(C)
        time = it / idtm
        pulse_response=Co
        for i,ts in enumerate(T): 
          pulse_response=pulse_response+C[i]*np.exp(-time/ts)

        return pulse_response