-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendar_dawn.py
43 lines (34 loc) · 1.37 KB
/
calendar_dawn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
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
"""Dawn Calendar Plotter - Generates a circular calendar visualization combining dawn twilight times and weather data."""
import sys
import traceback
from components.config import ConfigurationError, load_config
from components.data_handler import DataHandler
from components.base_calendar_plotter import BaseCalendarPlotter
from components.layer_dawn import DawnLayer
from components.layer_temperature import TemperatureLayer
def main():
try:
# Setup configuration
config = load_config()
config.city_name = sys.argv[1] if len(
sys.argv) > 1 else config.city_name
config.file_name = f"{config.city_name}_Dawn"
# Load data and initialize layers
data_handler = DataHandler(config)
(config.dawn_data, config.weather_data,
config.city_data, config.sun_data) = data_handler.load_data()
# Create and combine layers
plotter = BaseCalendarPlotter(config)
plotter.create_plot(layers=[
DawnLayer(config),
TemperatureLayer(config)
])
except ConfigurationError as e:
print(f"Configuration error: {str(e)}")
exit(1)
except Exception as e:
print(f"Error: {type(e).__name__} - {str(e)
}\n\n{''.join(traceback.format_tb(e.__traceback__))}")
exit(1)
if __name__ == "__main__":
main()