Skip to content

Commit

Permalink
Fixes station coordinates not calculated with decimals
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Sep 8, 2020
1 parent c0b2326 commit fbb2026
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_dwd_weatherforecast",
version="1.0.4",
version="1.0.5",
author="Max Fermor",
description="A simple tool to retrieve weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
6 changes: 4 additions & 2 deletions simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def get_nearest_station_id(lat: float, lon: float):
distance = 99999999
for line in stations.splitlines():
if (len(line) > 0 and line[0].isdigit()):
_lat = float(line[45:51].strip())
_lon = float(line[52:59].strip())
_lat = line[45:51].strip().split('.')
_lat = round(float(_lat[0])+float(_lat[1])/60, 2)
_lon = line[52:59].strip().split('.')
_lon = round(float(_lon[0])+float(_lon[1])/60, 2)
distance_temp = get_distance(lat, lon, _lat, _lon)
if distance > distance_temp:
distance = distance_temp
Expand Down

0 comments on commit fbb2026

Please sign in to comment.