model.co2calcs

Computes reductions for CO2 and total GHGs in CO2-equivalent emissions.

C_TO_CO2EQ = 3.666

Conversion factor from grams Carbon to grams CO2, used to calculate CO2 reduction from Carbon sequestration

class NumpyEncoder(json.encoder.JSONEncoder):

Extensible JSON http://json.org encoder for Python data structures.

Supports the following objects and types by default:

+-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+

To extend this to recognize other objects, subclass and implement a .default() method with another method that returns a serializable object for o if possible, otherwise it should call the superclass implementation (to raise TypeError).

def default(self, obj):

Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this::

def default(self, o):
    try:
        iterable = iter(o)
    except TypeError:
        pass
    else:
        return list(iterable)
    # Let the base class default method raise the TypeError
    return JSONEncoder.default(self, o)
def fair_scm_cached(json_input: str):
def fair_scm(values, useMultigas, **kwargs):
def co2_ppm_calculator_cached(co2_vals, solution_category, report_start_year):

Computes reductions for CO2 and total GHGs in CO2-equivalent emissions.

CO2Calcs( ac, soln_net_annual_funits_adopted=None, ch4_ppb_calculator=None, ch4_megatons_avoided_or_reduced=None, n2o_megatons_avoided_or_reduced=None, soln_pds_net_grid_electricity_units_saved=None, soln_pds_net_grid_electricity_units_used=None, soln_pds_direct_co2eq_emissions_saved=None, soln_pds_direct_co2_emissions_saved=None, soln_pds_direct_ch4_co2_emissions_saved=None, soln_pds_direct_n2o_co2_emissions_saved=None, soln_pds_new_iunits_reqd=None, soln_ref_new_iunits_reqd=None, conv_ref_new_iunits=None, conv_ref_grid_CO2_per_KWh=None, conv_ref_grid_CO2eq_per_KWh=None, fuel_in_liters=None, annual_land_area_harvested=None, regime_distribution=None, tot_red_in_deg_land=None, pds_protected_deg_land=None, ref_protected_deg_land=None, regimes=None)
def co2_mmt_reduced(self):

CO2 MMT Reduced

Annual CO2 reductions by region and year are calculated by adding reduced emissions derived from the electric grid, the replaced emissions derived from clean renewables, the net direct emissions derived from non-electric/non-fuel consumption, and the reduced emissions derived from fuel efficiency, and then subtracting the net indirect emissions. Most solutions will not utilize all of the defined factors.

NOTE: The emissions values used are from the regional future grid BAU CO2 emission intensity values (by year) from the AMPERE 3 MESSAGE Base model used in the IPCC 5th Assessment Report WG3.

| CO2 MMT Reduced = | (Grid Emissions Reduced + Grid Emissions Replaced - Grid Emissions by Solution) +
| Fuel Emissions Avoided + Direct Emissions Reduced - Net Indirect Emissions

def co2eq_mmt_reduced(self):

CO2-eq MMT Reduced

Annual CO2-eq reductions by region are calculated by multiplying the estimated energy unit savings by region by the emission factor of the energy unit in question by region and year. In this sample the values used are the regional future grid BAU CO2-eq emission intensity values (by year) from the AMPERE 3 MESSAGE Base model used in the IPCC 5th Assessment Report WG3.

| Reduced Grid MMT CO2-eq Emissions = NEU(t) * EF(e,t) | where: | NEU(t) = Net Energy Units at time, t | EF(e,t) = CO2-eq Emissions Factor of REF energy grid at time, t

def co2only_mmt_reduced(self):

CO2 MMT Reduced

Annual CO2 reductions by region are calculated by multiplying the estimated energy unit savings by region by the emission factor of the energy unit in question by region and year. In this sample the values used are the regional future grid BAU CO2-eq emission intensity values (by year) from the AMPERE 3 MESSAGE Base model used in the IPCC 5th Assessment Report WG3.

Reduced Grid MMT CO2 Emissions = NEU(t) * EF(e,t)

where NEU(t) = Net Energy Units at time, t EF(e,t) = CO2 Emissions Factor of REF energy grid at time, t

def co2_sequestered_global(self):

Total Carbon Sequestration (World section only) Returns DataFrame of net annual sequestration by thermal moisture region.

def co2_ppm_calculator(self):

CO2 parts per million reduction over time calculator.

Each yearly reduction in CO2 (in million metric ton - MMT) is modeled as a discrete avoided pulse. A Simplified atmospheric lifetime function for CO2 is taken from Myhrvald and Caldeira (2012) based on the Bern Carbon Cycle model. Atmospheric tons of CO2 are converted to parts per million CO2 based on the molar mass of CO2 and the moles of atmosphere. CO2-eq emissions are treated as CO2 for simplicity and due to the lack of detailed information on emissions of other GHGs. If these other GHGs are a significant part of overall reductions, this model may not be appropriate.

def co2eq_ppm_calculator(self):

PPM calculations for CO2, CH4, and CO2-eq from other sources. RRS: SolarPVUtil 'CO2 Calcs'!A171:F217 LAND: Improved Rice 'CO2 Calcs'!A224:H270

def co2_reduced_grid_emissions(self):

Reduced Grid Emissions = NE(t) * EF(e,t)

where NE(t) = Net Energy Units at time, t EF(e,t) = CO2 Emissions Factor of REF energy grid at time, t

def co2_replaced_grid_emissions(self):

CO2 Replaced Grid Emissions = NAFU(Sol,t) * EF(e,t) (i.e. only direct emissions) where NAFU(Sol,t) = Net annual functional units captured by solution at time, t EF(e,t) = CO2 Emissions Factor of REF energy grid at time, t

def co2_increased_grid_usage_emissions(self):

Increased Grid Emissions (MMT CO2e) = NEU(t) * EF(e,t)

where NEU(t) = Net Energy Units Used at time, t EF(e,t) = CO2 Emissions Factor of REF energy grid at time, t

def co2eq_reduced_grid_emissions(self):

Reduced Grid MMT CO2-eq Emissions = NEU(t) * EF(e,t)

where NEU(t) = Net Energy Units at time, t EF(e,t) = CO2-eq Emissions Factor of REF energy grid at time, t

def co2eq_replaced_grid_emissions(self):

CO2-equivalent replaced Grid MMT CO2-eq Emissions = NAFU(Sol,t) * EF(e,t)

where NAFU(Sol,t) = Net annual functional units captured by solution at time, t EF(e,t) = CO2-eq Emissions Factor of REF energy grid at time, t SolarPVUtil 'CO2 Calcs'!R288:AB334 (Not present in Land solutions)

def co2eq_increased_grid_usage_emissions(self):

Increased Grid Emissions (MMT CO2e) = NEU(t) * EF(e,t)

where NEU(t) = Net Energy Units Used at time, t EF(e,t) = CO2-eq Emissions Factor of REF energy grid at time, t SolarPVUtil 'CO2 Calcs'!AI288:AS334 Irrigation Efficiency 'CO2 Calcs'!R417:AB463

def co2eq_direct_reduced_emissions(self):

Direct MMT CO2-eq Emissions Reduced = [DEm(Con,t) - DEm(Sol,t)] / 1000000

where DEm(Con,t) = Direct Emissions of Conventional at time, t DEm(Sol,t) = Direct Emissions of Solution at time, t

NOTE: Includes CH4-CO2-eq and N2O-CO2-eq SolarPVUtil 'CO2 Calcs'!A344:K390

def co2only_direct_reduced_emissions(self):

Direct MMT CO2-eq Emissions Reduced = [DEm(Con,t) - DEm(Sol,t)] / 1000000

where DEm(Con,t) = Direct Emissions of Conventional at time, t DEm(Sol,t) = Direct Emissions of Solution at time, t

NOTE: Includes CH4-CO2-eq and N2O-CO2-eq SolarPVUtil 'CO2 Calcs'!A344:K390

def co2eq_reduced_fuel_emissions(self):

Reduced Fuel Emissions MMT CO2-eq = NAFU(Con,t) * Fuel(Con,t) * [Em(cf) - (1 - FRF) * Em(sf) * if(Fuel Units are Same, then: 1, else:UCF)]/10^6

where: NAFU(Con,t) = Net annual functional units captured by conventional mix at time, t Fuel(Con,t) = Conventional Fuel Consumption at time, t FRF = Fuel Efficiency Factor Em(cf) = Emissions Factor of conventional fuel type Em(sf) = Emissions Factor of solution fuel type UCF = Unit Conversion Factor (TJ per Liter or L per TJ depending on Conventional and Solution Fuel units. SolarPVUtil 'CO2 Calcs'!U344:AE390

def co2eq_net_indirect_emissions(self):

Net Indirect Emissions MMT CO2-eq by implementation unit (t) = [NIU (Sol,t) * IEm (Sol,t)] - [NIU (Cont.) * IEm (Con,t)] / 1000000 where: NIU(Sol,t) = New Implementation Units by solution at time, t IEm(Sol,t) = Indirect CO2-eq Emission of solution at time, t NIU(Con,t) = New Implementation Units by conventional mix at time, t IEm(Con,t) = Indirect CO2-eq Emission of conventional mix at time, t SolarPVUtil 'CO2 Calcs'!AP344:AZ390

def direct_emissions_from_harvesting(self):

Net Land Units [Mha]* (Carbon Sequestration Rate [t C/ha/yr] * Years of Sequestration [yr] - Carbon Stored even After Harvesting/Clearing [t C/ha]) * (CO2 per C) Afforestation 'CO2 Calcs'!CU365:DD411

def FaIR_CFT_baseline_co2eq(self):

Return FaIR results for the baseline case in CO2eq emissions.

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns DataFrame containing columns C, F, T: C: CO2 concentration in ppm for the World. F: Radiative forcing in watts per square meter T: Change in temperature since pre-industrial time in Kelvin

Assumes all methane and nitrous oxide emissions are first converted into CO2-eq emissions and then run FaIR in CO2-only mode. As a scientific note: this is very crude and a bad use of the FaIR model since CH4 and N2O have their own radiative forcings and lifetimes which CO2-eq poorly represents.

Assumes only one background emission of RCP4.5

def FaIR_CFT_Drawdown_co2eq(self):

Return FaIR results for the baseline + Drawdown solution in CO2eq emissions.

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns DataFrame containing columns C, F, T: C: CO2 concentration in ppm for the World. F: Radiative forcing in watts per square meter T: Change in temperature since pre-industrial time in Kelvin

def FaIR_CFT_baseline_RCP3(self):

Return FaIR results for the baseline case of RCP3 (formerly rcp2.6).

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_baseline_RCP45(self):

Return FaIR results for the baseline case of RCP4.5

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_baseline_RCP6(self):

Return FaIR results for the baseline case of RCP6.0

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_baseline_RCP85(self):

Return FaIR results for the baseline case of RCP8.5

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def ghg_emissions_reductions_global_annual(self):

Return annual emission reductions for 2014-2060. Columns of CO2 (Gt-C), CH4 (Mt-CH4), N2O (Mt-N2O)

def ghg_emissions_reductions_global_cumulative(self):

Return cumulative emission reductions for 2014-2060. For CO2 (Gt-C), CH4 (Mt-CH4), N2O (Mt-N2O)

def FaIR_CFT_Drawdown_RCP3(self):

Return FaIR results for the baseline + Drawdown case of RCP3 (formerly RCP2.6)

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_Drawdown_RCP45(self):

Return FaIR results for the baseline + Drawdown case of RCP4.5

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_Drawdown_RCP6(self):

Return FaIR results for the baseline + Drawdown case of RCP6.0

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def FaIR_CFT_Drawdown_RCP85(self):

Return FaIR results for the baseline + Drawdown case of RCP8.5

Finite Amplitude Impulse-Response simple climate-carbon-cycle model. https://github.com/OMS-NetZero/FAIR

Returns 4 DataFrames for years 1765-2500 containing: 1: Multigas concentrations for the World. CO2(ppm), CH4(ppb), N2O(ppb) 2: Radiative forcing in watts per square meter CO2(Wm-2), CH4(Wm-2), N2O(Wm-2), others(Wm-2), total(Wm-2) 3: Change in temperature since pre-industrial time in Celsius 4: RCP emissions (39 individual gases)

def co2_rf(x):
def f(M, N):
def ch4_rf(x):
def co2eq_ppm(x):