Skip to content

Commit

Permalink
fetch until today
Browse files Browse the repository at this point in the history
  • Loading branch information
jsga committed Jan 10, 2024
1 parent 707b92b commit e9328e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/api/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import io
import textwrap
from collections import defaultdict
from datetime import datetime

import aiohttp
import matplotlib as mpl
Expand Down Expand Up @@ -126,11 +127,13 @@ async def group_by_year(years: list, temps: list) -> tuple[list, list]:


async def fetch_weather_data(lat: float, lon: float) -> tuple[list[int], list[float]]:
today_date = datetime.today().strftime("%Y-%m-%d")

METEO_URL = (
"https://archive-api.open-meteo.com/v1/archive?"
f"latitude={lat}"
f"&longitude={lon}"
"&start_date=1940-01-01&end_date=2023-05-08&models=best_match"
f"&start_date=1940-01-01&end_date={today_date}&models=best_match"
"&daily=temperature_2m_mean&timezone=Europe%2FBerlin"
)

Expand Down

0 comments on commit e9328e5

Please sign in to comment.