#!/usr/bin/env python3 """Check real_radius for solar system planets only""" import asyncio import sys import os sys.path.append(os.path.join(os.getcwd(), "backend")) from app.database import AsyncSessionLocal from sqlalchemy import select from app.models.db.celestial_body import CelestialBody async def check_solar_system(): async with AsyncSessionLocal() as session: # Solar System body IDs solar_ids = ['10', '199', '299', '399', '499', '599', '699', '799', '899', '999', '2000001', '136199', '136108', '136472'] stmt = select(CelestialBody).where(CelestialBody.id.in_(solar_ids)) result = await session.execute(stmt) bodies = result.scalars().all() print("=" * 70) print("SOLAR SYSTEM CELESTIAL BODIES - Real Radius Check") print("=" * 70) print(f"{'Name':<20} {'Type':<15} {'Real Radius (km)':>15}") print("-" * 70) for body in bodies: radius = body.extra_data.get('real_radius') if body.extra_data else None print(f"{body.name:<20} {body.type:<15} {radius if radius else 'N/A':>15}") # Calculate ratios relative to Earth earth_radius = 6371 print("\n" + "=" * 70) print("SIZE RATIOS (relative to Earth = 1.0x)") print("=" * 70) for body in sorted(bodies, key=lambda b: b.extra_data.get('real_radius', 0) if b.extra_data else 0, reverse=True): if body.extra_data and body.extra_data.get('real_radius'): radius = body.extra_data['real_radius'] ratio = radius / earth_radius print(f"{body.name:<20}: {radius:>8.0f} km = {ratio:>6.2f}x Earth") if __name__ == "__main__": asyncio.run(check_solar_system())