Impact assessment
General
impact.get_emissions()
View Docstring
Signature:
get_emissions(session, scn, years, interpolate)
Docstring:
Collect emissions to the environment stored in various data attributes
and modules. The data attributes from where emissions are collected are defined
in the 'CIBUSmod/impact/data/emissions_attrs.csv' file. This file also group
emissions into a 'process' and a 'sub-process', which can be adjusted by changing
this file.
Output are grouped by process, sub-process, prod_system, item, region, and compound.
The 'item' level uses the 'crop_group2' aggregation for CropProduction emissions, 'species, breed' for
AnimalHerd emissions and 'treatment' for WasteAndCircularity emissions.
Parameters
----------
session : Session object
scn : (list of) str, default 'all'
years : (list of) str, default 'all'
interpolate : Bool, default False
Interpolate between defined years
Returns
-------
pandas.DataFrame
File: CIBUSmod/impact/general.py
impact.get_LSU()
View Docstring
Signature:
get_LSU(
session,
groupby,
scn,
years,
method,
interpolate
)
Docstring:
Gives animal numbers in terms of livestock units (LSU)
Parameters
----------
session : Session object
groupby : str, list or dict, default 'all'
If str or list data is grouped and aggregated by these levels.
If 'all' all available levels are returned
If 'none' data is summed over all levels
If a dict is supplied relation tables are used
scn : (list of) str
years : (list of) str
method : str, default 'factors'
Method to calculate LSUs
'factors' = LSU factors according to Eurostat
https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Glossary:Livestock_unit_(LSU)
interpolate : Bool, default False
If True interpolate between defined years
File: CIBUSmod/impact/livestock.py
Climate
impact.get_GHG()
View Docstring
Signature:
get_GHG(
session: Session,
scn: list[str] | str,
years: list[str] | str,
CO2eq: str | None,
interpolate: bool
)
Docstring:
Function to get greenhouse gas emissions from Session. Emissions are expressed in kg or kg CO2-eq
depending on 'CO2eq' setting.
This function relies on impact.get_emissions() to collect all emissions and then uses the file
'CIBUSmod/impact/data/emi_to_ghg.csv' to 1) select only greenhouse gas emissions, 2) convert units if
necessary (e.g. N2O-N --> N2O), and 3) calculate indirect N2O emissions from other nitrogen emissions
and leaching.
Characterization factors are defined in 'CIBUSmod/impact/data/ghg_to_CO2eq.csv' where the method column
corresponds to the allowable settings for 'CO2eq'. It is possible to add additional characterization methods
by adding rows in this file.
Parameters
----------
session : Session object
scn : (list of) str, default 'all'
Scenarios to include
years : (list of) str, default 'all'
Years to include
CO2eq : str or None, default 'GWP100 AR4'
Method for translating GHGs to CO2-eq, if None emissions are not translated to CO2-eq
interpolate : Bool, default False
Interpolate between defined years
Returns
-------
pandas.DataFrame of greenhouse gas emissions in kg or kg CO2-eq
File: CIBUSmod/impact/climate.py
impact.get_deltaT()
View Docstring
Signature:
get_deltaT(
session: Session | pd.DataFrame,
groupby: list[str] | str,
scn: str,
years: str,
extend: int,
extend_emissions: bool,
temp_resp_model: str,
temp_resp_version: str
)
Docstring:
Function to calculate the temperature response measured in Kelvin (K) from time-series of greenhouse gas emissions.
Paramters
---------
session : Session object
Alternatively a pandas.DataFrame can be supplyed,
should be a DataFrame of greenhouse gas emissions
as returned by impact.get_GHG(CO2eq=None, interpolate=True)
ghg_data : pandas.DataFrame, default None
Alternative to supplying a session object, should be a
DataFrame of greenhouse gas emissions as returned by
impact.get_GHG(CO2eq=None, interpolate=True)
groupby : (list of) str, default 'all'
Group results by levels
scn : (list of) str, default 'all'
Scenarios to include
years : (list of) str, default 'all'
Years to include
extend : int, default 0
Years by which to extend analysis of temperature
response from last year in scenario
extend_emissions : Bool, default False
If True emissions are assumed to remain constant
after last year in scenario, if False emissions
are assumed to be zero after last year
temp_resp_model : str, default 'C2012'
Temperature response model to use. One of:
- 'C2012' (Collins et al. 2012, AGTP formulation)
- 'E2013' (Ericsson et al. 2013, convolution method)
- 'E2014' (Ericsson et al. 2014, empirical constants)
temp_resp_version : str, default 'AR5
IPCC version for constants. One of:
- 'AR5'
- 'AR4'
Returns
-------
pandas.DataFrame of temperature response in Kelvin (K)
File: CIBUSmod/impact/climate.py
impact.get_GWPstar
View Docstring
Signature:
get_GWPstar(
session: Session | pd.DataFrame,
scn: list[str] | str,
years: list[str] | str,
CO2eq: str,
r: float,
s: float,
dt: int,
interpolate: bool
)
Docstring:
Function to get greenhouse gas emissions from Session expressed as kg CO2-w.e.
according to GWP* (Lynch et.al. 2020), an alternative application of GWPs where
the CO2-equivalence of short-lived climate pollutant (SLCP) emissions is predominantly
determined by changes in their emission rate.
Parameters
----------
session : Session object
scn : (list of) str, default 'all'
Scenarios to include
years : (list of) str, default 'all'
Years to include
CO2eq : str or None, default 'GWP100 AR4'
Method for translating GHGs to CO2-eq Should be one of the GWP methods
available in impact.get_GHG()
r : float, default 0.75 (as in Lynch et.al. 2020)
Weight given changes in rate of SLCP emissions
s : float, default 0.25 (as in Lynch et.al. 2020)
Weight given to SLCP emissions
dt : int, default 20 (as in Lynch et.al. 2020)
Number of years to average changes in SLCP emissions rate over (Δt)
interpolate : Bool, default False
Interpolate between defined years
Returns
-------
pandas.DataFrame of greenhouse gas emissions in kg CO2-w.e.
The GWP* calculations are implemented as described in Lynch et.al. (2020). Emissions before the start
of the scenarios are assumed equal to emissions in the first year in calculating GWP* for the years up
unitil 'dt' years after the start year. Only methane is considered a SLCP in the calculations implemented
in this function.
Lynch, J., Cain, M., Pierrehumbert, R. & Allen, M. (2020).
Demonstrating GWP*: a means of reporting warming-equivalent emissions that
captures the contrasting impacts of short- and long-lived climate pollutants.
Environmental Research Letters, 15(4), 044023. 10.1088/1748-9326/ab6d7e
File: CIBUSmod/impact/climate.py
Biodiversity
impact.get_crop_div()
View Docstring
Signature:
get_crop_div(
session,
groupby,
scn,
years,
method,
crop_group,
land_use,
interpolate
)
Docstring:
Gives crop diversity index
Parameters
----------
session : Session object
groupby : str, list or dict, default 'all'
If str or list data is grouped and aggregated by these levels.
If 'all' all available levels are returned
If 'none' data is summed over all levels
If a dict is supplied relation tables are used
scn : (list of) str
years : (list of) str
method : str, default 'factors'
Method to calculate crop diversity
'Shannon' = Shannon Diversity Index
'Hill' = Hill numbers of order q=1 (i.e. exp(Shannon))
crop_group : str, default 'crop_group'
Aggregation level to use in calculating diversity
land_use : str, default 'cropland'
Land use to calculate crop diversity for
interpolate : Bool, default False
If True interpolate between defined years
File: CIBUSmod/impact/biodiv.py
Land Use and Land Use Changes (LULUC)
impact.get_rewetting_emissions()
View Docstring
Signature:
get_rewetting_emissions(
session: Session,
year0: str,
CO2eq: str | None,
interpolate: bool,
return_area: bool,
EF_CO2: float,
EF_CH4: float
)
Docstring:
Function to calculate emissions of CO2 and CH4 from rewetted organic soils. Any
reduction in the area of organic soils in year0 is assumed to result in an equivalent
area of rewetted wetlands.
This will likely be replaced by a more comprehensive framework for handling land use
change and associated emissions in the future.
Parameters
----------
session : Session object
year0 : str
CO2eq : str or None, default 'GWP100 AR4'
Method for translating GHGs to CO2-eq, if None emissions are not translated to CO2-eq
interpolate : Bool, default False
Interpolate between defined years
return_area : Bool, default False
If True, returns area tuple of (rewetted area, emissions)
EF_CO2 : float, default from Lindgren & Lundblad (2014)
Emission factor for CO2 emissions in kg CO2/ha
EF_CH4 : float, default from Lindgren & Lundblad (2014)
Emission factor for CH4 emissions in kg CH4/ha
Returns
-------
pandas.DataFrame
of the same structure as returned by impact.get_GHG()
File: CIBUSmod/impact/LULUC.py