Skip to content

Commit

Permalink
Merge pull request #1 from jsga:fix/remove-hardcoded-date
Browse files Browse the repository at this point in the history
Fix/remove-hardcoded-date
  • Loading branch information
jsga authored Jan 10, 2024
2 parents 06e4028 + e9328e5 commit 394c360
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
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
Loading

0 comments on commit 394c360

Please sign in to comment.