Gaussian Plume
Gaussian Plume module.
The class for the Gaussian Plume dispersion model used in pyELQ.
The Mathematics of Atmospheric Dispersion Modeling, John M. Stockie, DOI. 10.1137/10080991X
GaussianPlume
dataclass
Bases: DispersionModel
Defines the Gaussian plume dispersion model class.
Attributes:
| Name | Type | Description |
|---|---|---|
source_half_width |
float
|
Source half width (radius) to be used in the Gaussian plume model (in meters) |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
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 59 60 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 147 148 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 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |
compute_coupling(sensor_object, meteorology_object, gas_object=None, output_stacked=False, run_interpolation=True)
Top level function to calculate the Gaussian plume coupling.
Calculates the coupling for either a single sensor object or a dictionary of sensor objects.
When both a SensorGroup and a MeteorologyGroup have been passed in, we assume they are consistent and contain exactly the same keys for each item in both groups. Also assuming interpolation has been performed and time axes are consistent, so we set run_interpolation to False
When you input a SensorGroup and a single Meteorology object we convert this object into a dictionary, so we don't have to duplicate the same code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_object
|
Union[SensorGroup, Sensor]
|
Single sensor object or SensorGroup object which is used in the calculation of the plume coupling. |
required |
meteorology_object
|
Union[MeteorologyGroup, Meteorology]
|
Meteorology object or MeteorologyGroup object which is used in the calculation of the plume coupling. |
required |
gas_object
|
GasSpecies
|
Optional input, a gas species object to correctly calculate the gas density which is used in the conversion of the units of the Gaussian plume coupling |
None
|
output_stacked
|
bool
|
if true outputs as stacked np.array across sensors if not outputs as dict |
False
|
run_interpolation
|
bool
|
logical indicating whether interpolation of the meteorological data to the sensor/source is required. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
plume_coupling |
Union[list, ndarray, dict]
|
List of arrays, single array or dictionary containing the plume coupling in hr/kg. When a single source object is passed in as input this function returns a list or an array depending on the sensor type. If a dictionary of sensor objects is passed in as input and output_stacked=False this function returns a dictionary consistent with the input dictionary keys, containing the corresponding plume coupling outputs for each sensor. If a dictionary of sensor objects is passed in as input and output_stacked=True this function returns a np.array containing the stacked coupling matrices. |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 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 | |
compute_coupling_single_sensor(sensor_object, meteorology, gas_object=None, run_interpolation=True)
Wrapper function to compute the gaussian plume coupling for a single sensor.
Wrapper is used to identify specific cases and calculate the Gaussian plume coupling accordingly.
When the sensor object contains the source_on attribute we set all coupling values to 0 for observations for which source_on is False. Making sure the source_on is column array, aligning with the 1st dimension (nof_observations) of the plume coupling array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_object
|
Sensor
|
Single sensor object which is used in the calculation of the plume coupling |
required |
meteorology
|
Meteorology
|
Meteorology object which is used in the calculation of the plume coupling |
required |
gas_object
|
GasSpecies
|
Optionally input a gas species object to correctly calculate the gas density which is used in the conversion of the units of the Gaussian plume coupling |
None
|
run_interpolation
|
bool
|
logical indicating whether interpolation of the meteorological data to the sensor/source is required. Default passed from compute_coupling. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
plume_coupling |
Union[list, ndarray]
|
List of arrays or single array containing the plume coupling in 1e6*[hr/kg]. Entries of the list are per source in the case of a satellite sensor, if a single array is returned the coupling for each observation (first dimension) to each source (second dimension) is provided. |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
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 147 148 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 | |
compute_coupling_array(sensor_x, sensor_y, sensor_z, source_z, wind_speed, theta, wind_turbulence_horizontal, wind_turbulence_vertical, gas_density)
Compute the Gaussian plume coupling.
Most low level function to calculate the Gaussian plume coupling. Assuming input shapes are consistent but no checking is done on this.
Setting sigma_vert to 1e-16 when it is identically zero (distance_x == 0) so we don't get a divide by 0 error all the time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_x
|
ndarray
|
sensor x location relative to source [m]. |
required |
sensor_y
|
ndarray
|
sensor y location relative to source [m]. |
required |
sensor_z
|
ndarray
|
sensor z location relative to ground height [m]. |
required |
source_z
|
ndarray
|
source z location relative to ground height [m]. |
required |
wind_speed
|
ndarray
|
wind speed at source locations in [m/s]. |
required |
theta
|
ndarray
|
Mathematical wind direction at source locations [radians]: calculated as np.arctan2(v_component_wind, u_component_wind). |
required |
wind_turbulence_horizontal
|
ndarray
|
Horizontal wind turbulence [deg]. |
required |
wind_turbulence_vertical
|
ndarray
|
Vertical wind turbulence [deg]. |
required |
gas_density
|
Union[float, ndarray]
|
Gas density to use in coupling calculation [kg/m^3]. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
plume_coupling |
ndarray
|
Gaussian plume coupling in (1e6)*[hr/kg]: gives concentrations in [ppm] when multiplied by sources in [kg/hr]. |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
compute_coupling_satellite(sensor_object, wind_speed, theta, wind_turbulence_horizontal, wind_turbulence_vertical, gas_density)
Compute Gaussian plume coupling for satellite sensor.
When the sensor is a Satellite object we calculate the plume coupling per source. Given the large number of sources and the possibility of using the inclusion radius and inclusion indices here and validity of a local ENU system over large distances we loop over each source and calculate the coupling on a per-source basis.
If source_map.inclusion_n_obs is None, we do not do any filtering on observations and we want to include all observations in the plume coupling calculations.
All np.ndarray inputs should have a shape of [1 x nof_sources]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_object
|
Sensor
|
Sensor object used in plume coupling calculation |
required |
wind_speed
|
ndarray
|
Wind speed [m/s] |
required |
theta
|
ndarray
|
Mathematical angle between the u- and v-components of wind [radians] |
required |
wind_turbulence_horizontal
|
ndarray
|
Parameter of the wind stability in horizontal direction [deg] |
required |
wind_turbulence_vertical
|
ndarray
|
Parameter of the wind stability in vertical direction [deg] |
required |
gas_density
|
ndarray
|
(np.ndarray): Numpy array containing the gas density values to use [kg/m^3] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
plume_coupling |
list
|
List of Gaussian plume coupling 1e6*[hr/kg] arrays. The list has a length of nof_sources, each array has the shape [nof_observations x 1] or [inclusion_n_obs x 1] when inclusion_idx is used. |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
compute_coupling_ground(sensor_object, wind_speed, theta, wind_turbulence_horizontal, wind_turbulence_vertical, gas_density)
Compute Gaussian plume coupling for a ground sensor.
If the source map is already defined as ENU the reference location is maintained but the sensor is checked to make sure the same reference location is used. Otherwise, when converting to ENU object for the sensor observations we use a single source and altitude 0 as the reference location. This way our ENU system is a system w.r.t. ground level which is required for the current implementation of the actual coupling calculation.
When the sensor is a Beam object we calculate the plume coupling for all sources to all beam knot locations at once in the same ENU coordinate system and finally averaged over the beam knots to get the final output.
In general, we calculate the coupling from all sources to all sensor observation locations. In order to achieve this we input the sensor array as column and source array as row vector in calculating relative x etc., with the beam knot locations being the third dimension. When the sensor is a single point Sensor or a Drone sensor we effectively have one beam knot, making the mean operation at the end effectively a reshape operation which gets rid of the third dimension.
All np.ndarray inputs should have a shape of [nof_observations x 1]
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_object
|
Sensor
|
Sensor object used in plume coupling calculation |
required |
wind_speed
|
ndarray
|
Wind speed [m/s] |
required |
theta
|
ndarray
|
Mathematical angle between the u- and v-components of wind [radians] |
required |
wind_turbulence_horizontal
|
ndarray
|
Parameter of the wind stability in horizontal direction [deg] |
required |
wind_turbulence_vertical
|
ndarray
|
Parameter of the wind stability in vertical direction [deg] |
required |
gas_density
|
ndarray
|
(np.ndarray): Numpy array containing the gas density values to use [kg/m^3] |
required |
Returns:
| Name | Type | Description |
|---|---|---|
plume_coupling |
ndarray
|
Gaussian plume coupling 1e6*[hr/kg] array. The array has the shape [nof_observations x nof_sources] |
Source code in src/pyelq/dispersion_model/gaussian_plume.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |