ciceroOslo/ciceroscm

inverse emissions calculation unstable with current parameters

Opened this issue · 3 comments

Current implementation of inverse carbon calculation can fail due to negative CO2 concentrations generated in bisection algorithm.

convergence fails when the log is taken in the npp calculation:
np.log(self.co2_hold["xCO2"] / 278.0)

(line 308, carbon_cycle_mod)
Propose reducing the width of the initial window:
from current

    min_guess = self.simplified_em_backward(co2_conc_now / 2, co2_conc_zero)
    max_guess = self.simplified_em_backward(co2_conc_now * 2, co2_conc_zero)

to the following:
min_guess = self.simplified_em_backward(co2_conc_now / 1.2, co2_conc_zero)
max_guess = self.simplified_em_backward(co2_conc_now * 1.2, co2_conc_zero)

This is still wide enough to accommodate vast annual +ve or -ve emissions, but seems in practise less likely to blow up.

Ideally, on the medium term to-do list, this should be a free parameter.

The width of the guess should be a free parameter, that seems a bit weird, this is the most like random starting point for solution iteration, it being a free parameter seems strange...? Also, can we just require that the minimal guess be larger than zero? Did you encounter this from back-calculating with a very flat emissions profile?

Is there somewhere that you have your setup for this that I can have look at, maybe I can think about a slightly less ad hoc solution...