aerocm.utils.functions¶
Utility functions for the AeroCM package.
emission_profile_function ¶
emission_profile_function(start_year, t0, time_horizon, profile, unit_value)
Generate an emission profile based on the specified type (e.g. pulse) and time horizon.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_year
|
int
|
Start year of the simulation. |
required |
t0
|
int
|
Year when the emission event occurs. |
required |
time_horizon
|
int
|
Duration of the emission profile in years. |
required |
profile
|
str
|
Type of emission profile: "pulse", "step", or "1% growth". |
required |
unit_value
|
float
|
Magnitude of the emission event. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
emissions |
ndarray
|
Emission profile array. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an invalid profile type is provided. |
Source code in aerocm/utils/functions.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
plot_simulation_results ¶
plot_simulation_results(ds, data_var, species=None, title=None, figsize=(8, 5), stacked=False, ax=None, label_prefix=None)
Plot selected species over time for a chosen data variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Dataset with dimensions (species, year). |
required |
data_var
|
str
|
Name of the data variable to plot (e.g. 'temperature_change'). |
required |
species
|
list[str]
|
Species names to plot. If None, all species are plotted. |
None
|
title
|
str
|
Custom plot title (ignored if ax is provided and already has one). |
None
|
figsize
|
tuple
|
Figure size in inches (only used if ax is None). |
(8, 5)
|
stacked
|
bool
|
If True, plots a stacked area chart instead of individual lines. |
False
|
ax
|
Axes
|
Existing matplotlib Axes to draw on. If None, a new figure is created. |
None
|
label_prefix
|
str
|
Optional prefix to add to species labels (useful when plotting multiple datasets). |
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If 'ds' is not an xarray.Dataset. |
ValueError
|
If 'data_var' is not found in the dataset or if specified species are missing. |
Source code in aerocm/utils/functions.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | |
show_model_info ¶
show_model_info(obj)
Pretty-print all public attributes (with current/default values) and methods of a class or instance.
Source code in aerocm/utils/functions.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |