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() {

๐Ÿ“‚ Click on any file below to view its contents:

+ {/* Solar profiles */} {[ - { name: "Solar - Gujarat", path: "/api/profiles/solar/GJ", type: "solar" }, - { name: "Solar - Karnataka", path: "/api/profiles/solar/KA", type: "solar" }, - { name: "Solar - Rajasthan", path: "/api/profiles/solar/RJ", type: "solar" }, - { name: "Wind - Gujarat", path: "/api/profiles/wind/GJ", type: "wind" }, - { name: "Wind - Karnataka", path: "/api/profiles/wind/KA", type: "wind" }, - { name: "Wind - Rajasthan", path: "/api/profiles/wind/RJ", type: "wind" }, + { name: "Solar - Gujarat", path: "/api/profiles/solar/GJ", type: "solar", cuf: 22.5 }, + { name: "Solar - Karnataka", path: "/api/profiles/solar/KA", type: "solar", cuf: 24.1 }, + { name: "Solar - Rajasthan", path: "/api/profiles/solar/RJ", type: "solar", cuf: 26.3 }, + { name: "Wind - Gujarat", path: "/api/profiles/wind/GJ", type: "wind", cuf: 28.5 }, + { name: "Wind - Karnataka", path: "/api/profiles/wind/KA", type: "wind", cuf: 32.2 }, + { name: "Wind - Rajasthan", path: "/api/profiles/wind/RJ", type: "wind", cuf: 25.8 }, ].map((profile) => (