Fixed direction math. Whoops

This commit is contained in:
scoobybejesus 2021-07-08 19:40:41 -04:00 committed by GitHub
parent 213591e564
commit 59111f37d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -919,7 +919,7 @@ def weather(bot, trigger):
def calculate_bearing(d): def calculate_bearing(d):
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'] dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
ix = int(round(d / (360. / len(dirs)))) ix = int(round(d / (360. / len(dirs))))
return dirs[(ix*2) % len(dirs)] return dirs[(ix) % len(dirs)]
direction = calculate_bearing(wind_deg) direction = calculate_bearing(wind_deg)
@ -965,7 +965,7 @@ def weatherf(bot, trigger):
def calculate_bearing(d): def calculate_bearing(d):
dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'] dirs = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']
ix = int(round(d / (360. / len(dirs)))) ix = int(round(d / (360. / len(dirs))))
return dirs[(ix*2) % len(dirs)] return dirs[(ix) % len(dirs)]
direction = calculate_bearing(wind_deg) direction = calculate_bearing(wind_deg)