cosmo/check_all_positions.py

37 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Check all positions for Earth"""
import asyncio
import sys
import os
sys.path.append(os.path.join(os.getcwd(), "backend"))
from app.database import AsyncSessionLocal
from app.services.db_service import position_service
async def check_all_positions():
"""Check all position data for Earth"""
async with AsyncSessionLocal() as session:
# Get all positions (no time filter)
positions = await position_service.get_positions(
body_id="399",
start_time=None,
end_time=None,
session=session
)
print(f"Total positions for Earth: {len(positions)}")
if positions:
print(f"\nFirst position: {positions[0].time}")
print(f"Last position: {positions[-1].time}")
print("\nSample of last 5 positions:")
for pos in positions[-5:]:
print(f" {pos.time}: ({pos.x:.6f}, {pos.y:.6f}, {pos.z:.6f})")
else:
print("\n❌ No positions at all!")
print("You need to download position data first.")
if __name__ == "__main__":
asyncio.run(check_all_positions())