diff --git a/packages/api/src/remodel_api/routers/profiles.py b/packages/api/src/remodel_api/routers/profiles.py index 5093641..937bf72 100644 --- a/packages/api/src/remodel_api/routers/profiles.py +++ b/packages/api/src/remodel_api/routers/profiles.py @@ -101,18 +101,40 @@ async def get_wind_profile( @router.get("/profiles/available") async def get_available_profiles() -> dict: - """Return list of available profiles.""" + """Return list of available profiles with CUF stats.""" + from remodel_engine.catalog.loader import load_solar_profile, load_wind_profile + + solar_profiles = [] + for loc_id, name in [("GJ", "Gujarat"), ("KA", "Karnataka"), ("RJ", "Rajasthan")]: + try: + data = load_solar_profile(loc_id) + avg = float(data.mean() * 100) + solar_profiles.append({ + "id": loc_id, + "name": name, + "path": f"/api/profiles/solar/{loc_id}", + "cuf_pct": round(avg, 2) + }) + except: + solar_profiles.append({"id": loc_id, "name": name, "path": f"/api/profiles/solar/{loc_id}", "cuf_pct": None}) + + wind_profiles = [] + for loc_id, name in [("GJ", "Gujarat"), ("KA", "Karnataka"), ("RJ", "Rajasthan")]: + try: + data = load_wind_profile(loc_id) + avg = float(data.mean() * 100) + wind_profiles.append({ + "id": loc_id, + "name": name, + "path": f"/api/profiles/wind/{loc_id}", + "cuf_pct": round(avg, 2) + }) + except: + wind_profiles.append({"id": loc_id, "name": name, "path": f"/api/profiles/wind/{loc_id}", "cuf_pct": None}) + return { - "solar": [ - {"id": "GJ", "name": "Gujarat", "path": "/api/profiles/solar/GJ"}, - {"id": "KA", "name": "Karnataka", "path": "/api/profiles/solar/KA"}, - {"id": "RJ", "name": "Rajasthan", "path": "/api/profiles/solar/RJ"}, - ], - "wind": [ - {"id": "GJ", "name": "Gujarat", "path": "/api/profiles/wind/GJ"}, - {"id": "KA", "name": "Karnataka", "path": "/api/profiles/wind/KA"}, - {"id": "RJ", "name": "Rajasthan", "path": "/api/profiles/wind/RJ"}, - ], + "solar": solar_profiles, + "wind": wind_profiles, } diff --git a/packages/web/components/ProfileViewer.tsx b/packages/web/components/ProfileViewer.tsx index b9ec990..c57aee2 100644 --- a/packages/web/components/ProfileViewer.tsx +++ b/packages/web/components/ProfileViewer.tsx @@ -333,13 +333,14 @@ export function ProfileViewer() {