Files
BrainWind/app/src/lib/stations-lookup.ts
T

38 lines
1.2 KiB
TypeScript

/**
* Auxiliares para a base de estações meteorológicas (Anexo C).
*/
import {
METEOROLOGICAL_STATIONS,
getStationById,
searchStations,
type MeteorologicalStation,
} from './nbr-tables/stations';
export { METEOROLOGICAL_STATIONS, getStationById, searchStations };
export type { MeteorologicalStation };
/**
* Estima V₀ a partir de coordenadas geográficas por interpolação das
* isopletas (Figura 1). Heurística simplificada baseada em latitude:
* - Sul do Brasil (|lat| > 25°): V₀ = 45 m/s
* - Sudeste/Centro-Oeste (15° a 25°): V₀ = 35 m/s
* - Norte/Nordeste (|lat| < 15°): V₀ = 30 m/s
*
* Para precisão, prefira a base de estações.
*/
export function estimateV0FromLatitude(latitude: number): number {
const lat = Math.abs(latitude);
if (lat > 25) return 45;
if (lat >= 15) return 35;
return 30;
}
/** Retorna a estação mais próxima por nome (heurística simples) */
export function findClosestStation(target: string): MeteorologicalStation | undefined {
const q = target.trim().toLowerCase();
if (!q) return undefined;
const matches = searchStations(q);
if (matches.length === 0) return undefined;
return matches[0];
}