27 lines
918 B
Python
27 lines
918 B
Python
"""Real-time global 10m wind field analytics & spatial point query APIs."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.core.access_gate import require_earth_or_api_access
|
|
from app.db.session import get_db
|
|
from app.services.earth_wind import get_wind_analysis_summary, query_wind_point
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
@router.get("/summary", dependencies=[Depends(require_earth_or_api_access("earth:read"))])
|
|
async def get_wind_summary(db: AsyncSession = Depends(get_db)):
|
|
return await get_wind_analysis_summary(db)
|
|
|
|
|
|
@router.get("/point", dependencies=[Depends(require_earth_or_api_access("earth:read"))])
|
|
async def get_wind_point(
|
|
lat: float = Query(..., ge=-90.0, le=90.0),
|
|
lon: float = Query(..., ge=-180.0, le=180.0),
|
|
db: AsyncSession = Depends(get_db),
|
|
):
|
|
return await query_wind_point(lat, lon, db=db)
|