mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-07 01:13:14 +02:00
normalizing
This commit is contained in:
@@ -40,7 +40,7 @@ def get_tide(lat=0, lon=0):
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
if station_json['stationList'] == [] or station_json['stationList'] is None:
|
||||
return "no station found"
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
station_id = station_json['stationList'][0]['stationId']
|
||||
|
||||
@@ -100,7 +100,7 @@ def get_weather(lat=0, lon=0, unit=0):
|
||||
table = soup.find('div', id="detailed-forecast-body")
|
||||
|
||||
if table is None:
|
||||
return "no weather data found on NOAA for your location"
|
||||
return ERROR_FETCHING_DATA
|
||||
else:
|
||||
# get rows
|
||||
rows = table.find_all('div', class_="row")
|
||||
@@ -118,7 +118,7 @@ def get_weather(lat=0, lon=0, unit=0):
|
||||
# get any alerts and return the count
|
||||
alerts = getWeatherAlerts(lat, lon)
|
||||
|
||||
if alerts == "No weather alerts found" or alerts == ERROR_FETCHING_DATA or alerts == NO_DATA_NOGPS:
|
||||
if alerts == ERROR_FETCHING_DATA or alerts == NO_DATA_NOGPS:
|
||||
alert = ""
|
||||
alert_num = 0
|
||||
else:
|
||||
@@ -200,7 +200,7 @@ def getWeatherAlerts(lat=0, lon=0):
|
||||
)
|
||||
|
||||
if alerts == "" or alerts == None:
|
||||
return "No weather alerts found"
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
# trim off last newline
|
||||
if alerts[-1] == "\n":
|
||||
@@ -253,7 +253,7 @@ def getActiveWeatherAlertsDetail(lat=0, lon=0):
|
||||
alerts = alerts.split("\n***\n")[:ALERT_COUNT]
|
||||
|
||||
if alerts == "" or alerts == ['']:
|
||||
return "No weather alerts found"
|
||||
return ERROR_FETCHING_DATA
|
||||
|
||||
# trim off last newline
|
||||
if alerts[-1] == "\n":
|
||||
|
||||
@@ -20,7 +20,7 @@ def hf_band_conditions():
|
||||
for i in solarxml.getElementsByTagName("band"):
|
||||
hf_cond += i.getAttribute("time")[0]+i.getAttribute("name") +"="+str(i.childNodes[0].data)+"\n"
|
||||
else:
|
||||
hf_cond += "error fetching"
|
||||
hf_cond += ERROR_FETCHING_DATA
|
||||
hf_cond = hf_cond[:-1] # remove the last newline
|
||||
return hf_cond
|
||||
|
||||
@@ -39,7 +39,7 @@ def solar_conditions():
|
||||
signalnoise = i.getElementsByTagName("signalnoise")[0].childNodes[0].data
|
||||
solar_cond = "A-Index: " + solar_a_index + "\nK-Index: " + solar_k_index + "\nSunspots: " + sunspots + "\nX-Ray Flux: " + solar_xray + "\nSolar Flux: " + solar_flux + "\nSignal Noise: " + signalnoise
|
||||
else:
|
||||
solar_cond += "error fetching"
|
||||
solar_cond += ERROR_FETCHING_DATA
|
||||
return solar_cond
|
||||
|
||||
def drap_xray_conditions():
|
||||
@@ -53,7 +53,7 @@ def drap_xray_conditions():
|
||||
if x_filter in line:
|
||||
xray_flux = line.split(": ")[1]
|
||||
else:
|
||||
xray_flux += "error fetching"
|
||||
xray_flux += ERROR_FETCHING_DATA
|
||||
return xray_flux
|
||||
|
||||
def get_sun(lat=0, lon=0):
|
||||
|
||||
Reference in New Issue
Block a user