mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Tune turbulence values. Modify the range of values used to choose a wind speed. Wind speed at high elevation IRL can range from 20 to 160 knots around the globe. You may see wind speed generated here up to 100+ knots, but generally around 40 or so. IRL wind speed appears to depend on the latitude of the sun, not in this implementation. Note increased wind speeds in the changelog. Limit wind speed to 97 knots. Made minor adjustments to wind speed calculation. Calculate turbulance. Turbulance is based off time of day, and day of year. Each theatre may adjust their turbulance parameters. Spell turbulence correctly.
54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
import datetime
|
|
from dataclasses import dataclass
|
|
from enum import Enum
|
|
|
|
|
|
class Season(Enum):
|
|
Winter = "winter"
|
|
Spring = "spring"
|
|
Summer = "summer"
|
|
Fall = "fall"
|
|
|
|
|
|
def determine_season(day: datetime.date) -> Season:
|
|
# Note: This logic doesn't need to be very precise
|
|
# Currently refers strictly to northern-hemisphere seasons
|
|
day_of_year = day.timetuple().tm_yday
|
|
season_length = 365.0 / 4
|
|
winter_end_day = season_length / 2
|
|
if day_of_year < winter_end_day:
|
|
return Season.Winter
|
|
elif day_of_year < winter_end_day + season_length:
|
|
return Season.Spring
|
|
elif day_of_year < winter_end_day + season_length * 2:
|
|
return Season.Summer
|
|
elif day_of_year < winter_end_day + season_length * 3:
|
|
return Season.Fall
|
|
else:
|
|
return Season.Winter
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class WeatherTypeChances:
|
|
thunderstorm: float
|
|
raining: float
|
|
cloudy: float
|
|
clear_skies: float
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SeasonalConditions:
|
|
# Units are inHg and degrees Celsius
|
|
summer_avg_pressure: float
|
|
winter_avg_pressure: float
|
|
summer_avg_temperature: float
|
|
winter_avg_temperature: float
|
|
temperature_day_night_difference: float
|
|
|
|
high_avg_yearly_turbulence_per_10cm: float
|
|
low_avg_yearly_turbulence_per_10cm: float
|
|
solar_noon_turbulence_per_10cm: float
|
|
midnight_turbulence_per_10cm: float
|
|
|
|
weather_type_chances: dict[Season, WeatherTypeChances]
|