ciceroOslo / ciceroscm

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

Alternative biotic decay function with user defiend parameters. #102

Closed benmsanderson closed 1 year ago

benmsanderson commented 1 year ago

allow an alternative _rb_new (to replace _rb_function in concentrations_emissions_handler.py), with user defined vector parameters - such that.

rb_C=np.array([0.70211,13.4141e-3,- 0.71846,2.9323e-3])
rb_T=np.array([1/.35,20.,120/55.,100.])
#Condition - all elements >0

def _rb_new(it, C=rb_C, T=rb_T,  idtm=24):
    time = it / idtm
    biotic_decay=0
    for i,ts in enumerate(T): 
        biotic_decay=biotic_decay+C[i]*np.exp(-time/ts)

    return biotic_decay
maritsandstad commented 1 year ago

More or less this?

def make_rb_function_from_arrays(rb_C, rb_T):
    rb_C, rb_T = check_array_consistency(rb_C, rb_T, 1)
    rb = lambda it, idtm : rb_C[0] +  np.multiply(rs_C[1:],np.exp(-it/rs_T/idtm))
    return rb