timestamp takes into account non UTC in weather
This commit is contained in:
@@ -5,6 +5,7 @@ import xml.etree.ElementTree as ET
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from rowingdata import rowingdata,geo_distance
|
from rowingdata import rowingdata,geo_distance
|
||||||
|
import arrow
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from rowers.models import Rower, Workout
|
from rowers.models import Rower, Workout
|
||||||
|
|
||||||
@@ -36,8 +37,8 @@ def get_weather_data(long,lat,unixtime):
|
|||||||
# Get Metar data
|
# Get Metar data
|
||||||
def get_metar_data(airportcode,unixtime):
|
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 = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&startTime="
|
||||||
url += str(unixtime-3600)
|
url += str(unixtime-3600)
|
||||||
url += "&endTime="
|
url += "&endTime="
|
||||||
@@ -122,8 +123,8 @@ def get_wind_data(lat,long,unixtime):
|
|||||||
windspeed = windspeed*(0.1)**0.34
|
windspeed = windspeed*(0.1)**0.34
|
||||||
windspeed = 0.01*int(100*windspeed)
|
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 = 'Summary for your location at '+timestamp+': '+summary
|
||||||
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'
|
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user