feat: implement Open-Meteo weather integration with backfill scripts and updated lake data models.
continuous-integration/drone/push Build encountered an error
continuous-integration/drone/push Build encountered an error
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import axios from 'axios';
|
||||
import { lakesConfig } from './scripts/lakesConfig';
|
||||
|
||||
async function testHistory() {
|
||||
const lipno = lakesConfig.find(l => l.id.startsWith('VLL1'));
|
||||
if (!lipno) return;
|
||||
const url = `https://api.open-meteo.com/v1/forecast?latitude=${lipno.coords[0]}&longitude=${lipno.coords[1]}&past_days=7&hourly=temperature_2m,precipitation&timezone=GMT`;
|
||||
console.log('Fetching from:', url);
|
||||
try {
|
||||
const res = await axios.get(url);
|
||||
const hourly = res.data.hourly;
|
||||
console.log(`Received ${hourly.time.length} hourly records.`);
|
||||
console.log('Sample record at index 100:');
|
||||
console.log('Time:', hourly.time[100]);
|
||||
console.log('Temp:', hourly.temperature_2m[100]);
|
||||
} catch (e) {
|
||||
console.error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
testHistory();
|
||||
Reference in New Issue
Block a user