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.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#!/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")
|
||||
Reference in New Issue
Block a user