Files
Astrape/debug_weather.py
T
rpotter6298 0814e7c965 Fix: Use issued_at instead of target_at for zero-hour resolved truth timestamps
The zero-hour forecasts (observations) were being saved with resolved_at = target_at,
which could be in the future. This caused them to be filtered out by the time-based
query in load_display_dataset(). Now using issued_at (when the observation was made)
ensures the timestamps fall within the valid display range.
2026-04-25 21:00:34 +02:00

32 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Debug script to trace resolved truth data."""
from gibil.classes.env_loader import EnvLoader
from gibil.classes.weather_store import WeatherStore
from gibil.classes.weather_display import WeatherDisplay
from datetime import datetime, timezone
EnvLoader().load()
store = WeatherStore.from_env()
dataset = store.load_display_dataset()
print(f"\n=== DEBUG OUTPUT ===")
print(f"Forecast points: {len(dataset.forecast_points)}")
print(f"Resolved truth points: {len(dataset.resolved_truth)}")
print(f"\nResolved truth details:")
for i, point in enumerate(dataset.resolved_truth):
print(f" [{i}] resolved_at={point.resolved_at}, temp={point.temperature_c}, radiation={point.shortwave_radiation_w_m2}")
print(f"\nAPI payload:")
display = WeatherDisplay()
payload = display.data_payload(dataset)
import json
data = json.loads(payload)
print(f" Resolved truth in payload: {len(data['resolved_truth'])}")
for i, point in enumerate(data['resolved_truth']):
print(f" [{i}] resolved_at={point['resolved_at']}, temp={point['temperature_c']}")
print(f"\n=== END DEBUG ===\n")