Atmo
Atmo
¶
Atmo(
altitude: Optional[Union[float, Distance]] = None,
pressure: Optional[Union[float, Pressure]] = None,
temperature: Optional[Union[float, Temperature]] = None,
humidity: float = 0.0,
powder_t: Optional[Union[float, Temperature]] = None,
)
Atmospheric conditions and density calculations.
Attributes:
Name | Type | Description |
---|---|---|
altitude |
Distance
|
Altitude relative to sea level |
pressure |
Pressure
|
Unadjusted barometric pressure, a.k.a. station pressure |
temperature |
Temperature
|
Temperature |
humidity |
float
|
Relative humidity [0% to 100%] |
powder_temp |
Temperature
|
Temperature of powder (if different from atmosphere). (Used when Ammo.use_powder_sensitivity is True) |
density_ratio |
float
|
Ratio of current density to standard atmospheric density |
mach |
Velocity
|
Velocity of sound (Mach 1) for current atmosphere |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
Optional[Union[float, Distance]]
|
Altitude relative to sea level |
None
|
pressure
|
Optional[Union[float, Pressure]]
|
Atmospheric pressure |
None
|
temperature
|
Optional[Union[float, Temperature]]
|
Atmospheric temperature |
None
|
humidity
|
float
|
Atmospheric relative humidity [0% to 100%] |
0.0
|
powder_t
|
Optional[Union[float, Temperature]]
|
Custom temperature of powder different to atmospheric. Used when Ammo.use_powder_sensitivity is True |
None
|
Example
from py_ballisticcalc import Atmo
atmo = Atmo(
altitude=Unit.Meter(100),
pressure=Unit.hPa(1000),
temperature=Unit.Celsius(20),
humidity=50,
powder_t=Unit.Celsius(15)
)
Methods:
Name | Description |
---|---|
update_density_ratio |
Update the density ratio based on current conditions. |
temperature_at_altitude |
Temperature at altitude interpolated from zero conditions using lapse rate. |
pressure_at_altitude |
Pressure at altitude interpolated from zero conditions using lapse rate. |
get_density_and_mach_for_altitude |
Calculate density ratio and Mach 1 for the specified altitude. |
standard_temperature |
Calculate ICAO standard temperature for altitude. |
standard_pressure |
Calculate ICAO standard pressure for altitude. |
icao |
Create Atmo instance of standard ICAO atmosphere at given altitude. |
machF |
Calculate Mach 1 in fps for given Fahrenheit temperature. |
machC |
Calculate Mach 1 in mps for given Celsius temperature. |
machK |
Calculate Mach 1 in mps for given Kelvin temperature. |
calculate_air_density |
Calculate air density from temperature, pressure, and humidity. |
Source code in py_ballisticcalc/conditions.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 |
|
Attributes¶
density_ratio
property
¶
density_ratio: float
Ratio of current density to standard atmospheric density.
Functions¶
update_density_ratio
¶
update_density_ratio() -> None
Update the density ratio based on current conditions.
Source code in py_ballisticcalc/conditions.py
172 173 174 |
|
temperature_at_altitude
¶
Temperature at altitude interpolated from zero conditions using lapse rate.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
float
|
ASL in ft |
required |
Returns:
Type | Description |
---|---|
float
|
temperature in °C |
Source code in py_ballisticcalc/conditions.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
pressure_at_altitude
¶
Pressure at altitude interpolated from zero conditions using lapse rate.
Ref: https://en.wikipedia.org/wiki/Barometric_formula#Pressure_equations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
float
|
ASL in ft |
required |
Returns:
Type | Description |
---|---|
float
|
pressure in hPa |
Source code in py_ballisticcalc/conditions.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
get_density_and_mach_for_altitude
¶
Calculate density ratio and Mach 1 for the specified altitude.
Ref: https://en.wikipedia.org/wiki/Barometric_formula#Density_equations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
float
|
ASL in units of feet. Note: Altitude above 36,000 ft not modelled this way. |
required |
Returns:
Type | Description |
---|---|
Tuple[float, float]
|
density ratio and Mach 1 (fps) for the specified altitude |
Source code in py_ballisticcalc/conditions.py
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 |
|
standard_temperature
staticmethod
¶
standard_temperature(altitude: Distance) -> Temperature
Calculate ICAO standard temperature for altitude.
Note: This model is only valid up to the troposphere (~36,000 ft).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
Distance
|
ASL in units of feet. |
required |
Returns:
Type | Description |
---|---|
Temperature
|
ICAO standard temperature for altitude |
Source code in py_ballisticcalc/conditions.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|
standard_pressure
staticmethod
¶
Calculate ICAO standard pressure for altitude.
Note: This model only valid up to troposphere (~36,000 ft). Ref: https://en.wikipedia.org/wiki/Barometric_formula#Pressure_equations
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
Distance
|
Distance above sea level (ASL) |
required |
Returns:
Type | Description |
---|---|
Pressure
|
ICAO standard pressure for altitude |
Source code in py_ballisticcalc/conditions.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
icao
staticmethod
¶
icao(
altitude: Union[float, Distance] = 0,
temperature: Optional[Temperature] = None,
humidity: float = cStandardHumidity,
) -> Atmo
Create Atmo instance of standard ICAO atmosphere at given altitude.
Note: This model is only valid up to the troposphere (~36,000 ft).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
altitude
|
Union[float, Distance]
|
relative to sea level. Default is sea level (0 ft). |
0
|
temperature
|
Optional[Temperature]
|
air temperature. Default is standard temperature at altitude. |
None
|
Returns:
Type | Description |
---|---|
Atmo
|
Atmo instance of standard ICAO atmosphere at given altitude. |
Atmo
|
If temperature not specified uses standard temperature. |
Source code in py_ballisticcalc/conditions.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
|
machF
staticmethod
¶
Calculate Mach 1 in fps for given Fahrenheit temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fahrenheit
|
float
|
Fahrenheit temperature |
required |
Returns:
Type | Description |
---|---|
float
|
Mach 1 in fps for given temperature |
Source code in py_ballisticcalc/conditions.py
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
machC
staticmethod
¶
Calculate Mach 1 in mps for given Celsius temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
celsius
|
float
|
Celsius temperature |
required |
Returns:
Type | Description |
---|---|
float
|
Mach 1 in mps for given temperature |
Source code in py_ballisticcalc/conditions.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
machK
staticmethod
¶
Calculate Mach 1 in mps for given Kelvin temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kelvin
|
float
|
Kelvin temperature |
required |
Returns:
Type | Description |
---|---|
float
|
Mach 1 in mps for given temperature |
Source code in py_ballisticcalc/conditions.py
346 347 348 349 350 351 352 353 354 355 356 |
|
calculate_air_density
staticmethod
¶
Calculate air density from temperature, pressure, and humidity.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
t
|
float
|
Temperature in degrees Celsius. |
required |
p_hpa
|
float
|
Pressure in hPa (hectopascals). Internally converted to Pa. |
required |
humidity
|
float
|
Relative humidity. Accepts either fraction [0..1] or percent [0..100]. |
required |
Returns:
Type | Description |
---|---|
float
|
Air density in kg/m³. |
Notes
- Divide result by cDensityImperialToMetric to get density in lb/ft³
- Source: https://www.nist.gov/system/files/documents/calibrations/CIPM-2007.pdf
Source code in py_ballisticcalc/conditions.py
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 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
Vacuum
¶
Vacuum(
altitude: Optional[Union[float, Distance]] = None,
temperature: Optional[Union[float, Temperature]] = None,
)
Bases: Atmo
Vacuum atmosphere (zero drag).
Source code in py_ballisticcalc/conditions.py
437 438 439 440 441 442 |
|