Emission models¶
Functions that can be used to generate some parts of inventory data.
Heating Degree Days (HDD)¶
Heating degree days (HDD) profile.
- emiproc.profiles.hdd.create_HDD_scaling_factor(
- serie_T: Series,
- heating_profile: list[TemporalProfile],
- dhw_profile: list[TemporalProfile],
- min_heating_T: float = 12.0,
- inside_T: float = 20.0,
- dhw_scaling: float = 0.23291666666666666,
Generate the scaling factor for the heating degree days formula.
The HDD formula procceds this way: first Calculate the mean temprature of the day, and the heating demeand for the day
\[HDD = (T_{inside} - T_{mean})\]Where \(T_{inside}\) is the inside temperature and \(T_{mean}\) is the mean temperature of the day.
If \(T_{mean} > T_{min}\) then the heating is not activated and \(HDD = 0\).
A day of year profile can then be calculated using
\[a_{HDD} = \frac{HDD}{\overline{HDD}}\]Where \(\overline{HDD}\) is the yearly average of the HDD.
A profile for domestic hot water is then added to this profile.
\[a_{H} = (1 - f_{DHW}) * HDD_{H} * a_{HDD} + a_{DHW} * f_{DHW}\]Where \(HDD_{H}\) is the hourly heating profile and \(a_{DHW}\) is the hourly domestic hot water profile and \(f_{DHW}\) is the scaling factor for the domestic hot water profile.
Thus the return profile correspond to both heating and domestic hot water, with a hourly resolution.
- Parameters:
serie_T – the timeserie of the temperature (in Celsius)
heating_profile – the heating profile
dhw_profile – the domestic hot water profile
min_heating_T – the minimum temperature for which heating is activated
inside_T – the inside temperature
dhw_scaling – \(f_{DHW}\), the scaling of domesting hot water demand vs surface heating must be a ratio between 0 and 1. If 0, the profiles will correspond to space heating only.
Human Respiration¶
Emiproc provides tools to help generate human respiration emissions.
- class emiproc.human_respiration.EmissionFactor¶
Emissions factors are how much of a compound is produced per individual per day.
Units are kg/day (kg of the compounds)
- emiproc.human_respiration.load_data_from_quartieranalyse(
- file: PathLike,
- grid: RegularGrid | None = None,
Load the data required from the quartieranalyse file from zurich.
- Parameters:
file – The Path to the Quartier data file.
grid – Optionally the grid of the simulation. This helps to load the data.
- Returns:
A geodataframe containing columns: geometry: The shapes of the different zones people_working: The number of people who work in these zones people_living: The number of people who live in these zones
- emiproc.human_respiration.people_to_emissions(
- people_gdf: GeoDataFrame,
- time_ratios: dict[Category, float],
- emission_factor: dict[tuple[Category, Substance], float] | float = 1.0,
- output_gdfs: bool = False,
- name: str = 'human_respiration',
- substance: Substance = 'CO2',
Get human respiration emissions.
Convert the number of people living in different areas to annual emission of CO2 from human respiration.
Different categories can be provided in the input. (ex. working, living, etc.)
The formula used is quite simple:
\[\text{emissions} [kg/y/shape] = \text{emission factor} [kg/p/d] * \text{people} [p/shape] * \text{time ratio} [-] * \text{days per year} [d/y]\]- Parameters:
people_gdf – A geodataframe containing the number of people for each geometry/shape/row. Each column must be named after the category of people.
time_ratios – The ratio of time that people spend for each category. The sum of all the ratios must be 1. Ex: {‘working’: 0.3, ‘living’: 0.7}.
emission_factor – The emission factor to use for each of the activities. Can be a single value or a dict with the same keys as the categories.
output_gdfs – Whether the output inventory should contain the emission data in gdfs instead of in the gdf(default).
name – The name of the inventory.
substance – The substance name of the emissions.
- Returns:
The Inventory containing human emissions.
VPRM¶
VPRM : Vegetation Photosynthesis and Respiration Model.
The VPRM model is a parametrized model that estimates the photosynthesis and respiration of vegetation based on satellite observations. The model was originally developed by [Mahadevan_2008] .
Various extensions of the VPRM model have been implemented in emiproc.
- enum emiproc.profiles.vprm.VPRM_Model(value)¶
Enum for the VPRM model types.
standard: Standard VPRM model [Mahadevan_2008]
urban: Original Urban VPRM model [Urban_VPRM_Hardiman_2017]
urban_winbourne: Urban VPRM model from Winbourne [Urban_VPRM_Winbourne_2021]
modified_groudji: Modified VPRM model [VPRM_modified_groudji_2022]
Valid values are as follows:
- standard = <VPRM_Model.standard: 'standard'>¶
- urban = <VPRM_Model.urban: 'urban'>¶
- urban_winbourne = <VPRM_Model.urban_winbourne: 'urban_winbourne'>¶
- modified_groudji = <VPRM_Model.modified_groudji: 'modified_groudji'>¶
- emiproc.profiles.vprm.calculate_vegetation_indices(
- nir: ndarray | DataArray,
- swir: ndarray | DataArray,
- red: ndarray | DataArray,
- blue: ndarray | DataArray,
- vprm_g: float = 2.5,
- vprm_c1: float = 6.0,
- vprm_c2: float = 7.5,
- vprm_l: float = 1.0,
- clip_evi: bool = False,
Calculate the vrpm products from the satellite observations.
The formulas are the following:
\[ \begin{align}\begin{aligned}\mathrm{EVI} &= \frac{G \cdot (\mathrm{NIR} - \mathrm{RED})}{(\mathrm{NIR} + C_1 \cdot \mathrm{RED} - C_2 \cdot \mathrm{BLUE}) + L}\\\newline\\\mathrm{LSWI} &= \frac{\mathrm{NIR} - \mathrm{SWIR}}{\mathrm{NIR} + \mathrm{SWIR}}\\\newline\\\mathrm{NDVI} &= \frac{\mathrm{NIR} - \mathrm{RED}}{\mathrm{NIR} + \mathrm{RED}}\end{aligned}\end{align} \]The input bands can by numpy arrays or xarray DataArrays.
- Parameters:
nir – Near Infrared band
swir – Shortwave Infrared band
red – Red band
blue – Blue band
vprm_g – Gain factor for EVI
vprm_c1 – Coefficient 1 for EVI
vprm_c2 – Coefficient 2 for EVI
vprm_l – Coefficient L for EVI
clip_evi – Clip the EVI values between 0 and 1. As the equation for EVI does not produce a proper index, values can be negative or above 1 if not clipped.
- Returns:
Tuple with the EVI, LSWI and NDVI
- emiproc.profiles.vprm.calculate_vprm_emissions(
- df: DataFrame,
- df_vprm: DataFrame,
- model: VPRM_Model | str = VPRM_Model.standard,
Calculate the emissions using the VPRM model.
This function uses timeseries of vegetation indices, temperature and radiation to calculate the respiration and photosynthesis emissions of vegetation.
For more details about the VPRM model, see VPRM .
- Parameters:
df –
Dataframe with the observations. It must be a multiindex dataframe with the following columns:
RAD: Shortwave radiation in W/m2
(‘T’, ‘global’): Temperature in degC
(vegetation_type, ‘lswi’): Land Surface Water Index
(vegetation_type, ‘evi’): Enhanced Vegetation Index
Urban VPRM models:
- (vegetation_type, ‘evi_ref’): Reference EVI for the urban VPRM model.
This is the EVI at a non-urban reference site representing a baseline leaf-off, woody biomass respiration.
- (‘T’, ‘urban’): Temperature in degC in the urban area,
representing the urban heat island effect.
df_vprm –
Dataframe with the VPRM parameters. Each row must correspond to a vegetation type and have the following columns:
alpha: Respiration parameter
beta: Respiration parameter
lambda: Photosynthesis parameter
Tmin: Minimum temperature for photosynthesis
Topt: Optimal temperature for photosynthesis
Tmax: Maximum temperature for photosynthesis
Tlow: Low temperature for photosynthesis
PAR0: Photosynthetically Active Radiation parameter
Urban VPRM models:
- isa: Impervious Surface Area (ISA) at the vegetation location.
This is the fraction of the area that is impervious (e.g. buildings, roads, etc.) Use 0.5 if you don’t know.
Modified VPRM:
theta1: Coeff for water respiration scaling factor
theta2: Coeff for water respiration scaling factor
theta3: Coeff for water respiration scaling factor
alpha1: Respiration parameter
alpha2: Respiration parameter
gamma: Coeff for EVI in respiration
Tcrit: critical temperature for respiration
Tmult: value between 0-1 to weigh the difference between atm temp and tcrit
model – VPRM model to use. See
VPRM_Modelfor the list of models.
- Returns:
Dataframe with the emissions. Some columns are added
(vegetation_type, ‘resp_min’): Respiration at the minimum temperature
(vegetation_type, ‘resp_max’): Respiration at the maximum temperature
(vegetation_type, ‘resp’): Respiration
(vegetation_type, ‘gee’): Gross Ecosystem Exchange
(vegetation_type, ‘nee’): Net Ecosystem Exchange (nee = gee - resp)
(vegetation_type, ‘Tscale’): Temperature scale
(vegetation_type, ‘Wscale’): Water scale
(vegetation_type, ‘Pscale’): Photosynthesis scale
Urban VPRM models:
(vegetation_type, ‘resp_h’): Heterotrophic respiration
(vegetation_type, ‘resp_a’): Autotrophic respiration
VRPM Plots¶
Plotting functions for VPRM profiles.
- emiproc.plots.vprm.plot_vprm_params_per_veg_type(
- df: DataFrame,
- df_vprm: DataFrame,
- veg_types: list[str] | None = None,
- model: VPRM_Model | str = VPRM_Model.standard,
- plots: list[str] = ['meteo', 'indices', 'emissions', 'scaling'],
- group_by: str | None = None,
Plot the VPRM parameters per vegetation type.
Each column is a vegetation type, and each row is a different plot.
Temperature and radiation
Vegetation indices
Emissions
Scaling parameters (Tscale, Wscale, Pscale)
- Parameters:
df – Dataframe with the observations. Output from
calculate_vprm_emissions().df_vprm – Dataframe with the VPRM parameters per vegetation type. Same input as the df_vprm parameter in
calculate_vprm_emissions().veg_types – List of vegetation types to plot. If None, all vegetation types in the dataframe will be plotted.
model – VPRM model to use. This is used to determine which parameters to plot.
plots – List of plots to create.
group_by – If provided, the dataframe will be grouped by this temporal frequency before plotting. e.g. “%m%H” to get daily profiles for each month.