Private
Public Access
1
0

timestamp takes into account non UTC in weather

This commit is contained in:
Sander Roosendaal
2017-10-14 10:05:29 +02:00
parent 69de5054b8
commit e3876ec85d

View File

@@ -5,6 +5,7 @@ import xml.etree.ElementTree as ET
import time
from datetime import datetime
from rowingdata import rowingdata,geo_distance
import arrow
import pandas as pd
from rowers.models import Rower, Workout
@@ -36,8 +37,8 @@ def get_weather_data(long,lat,unixtime):
# Get Metar data
def get_metar_data(airportcode,unixtime):
timestamp = datetime.utcfromtimestamp(unixtime).isoformat()+'Z'
timestamp = arrow.get(unixtime).isoformat()
url = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&startTime="
url += str(unixtime-3600)
url += "&endTime="
@@ -122,8 +123,8 @@ def get_wind_data(lat,long,unixtime):
windspeed = windspeed*(0.1)**0.34
windspeed = 0.01*int(100*windspeed)
timestamp = datetime.utcfromtimestamp(unixtime).isoformat()+'Z'
timestamp = arrow.get(unixtime).isoformat()
message = 'Summary for your location at '+timestamp+': '+summary
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'