Skip to content

Commit

Permalink
Added station to try except statement
Browse files Browse the repository at this point in the history
  • Loading branch information
waterresources committed Jul 6, 2021
1 parent 798d78b commit 55ac15b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WeatherStationData.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WsData:
# Initialization is defined, with parameters for other methods
def __init__(self, day, month, year, h_temp, l_temp, precip, station):
self.dt = self.__create_date__(day, month, year)
high, low = self.check_temps(h_temp, l_temp, self.dt)
high, low = self.check_temps(h_temp, l_temp, self.dt, station)

self.h_temp = high
self.l_temp = low
Expand All @@ -29,7 +29,7 @@ def __create_date__(self, day, month, year):
return datetime.date(y, m, d)

# checks the temps for the high and low, errors if it cannot convert the temp or high < low
def check_temps(self, h_temp, l_temp, dt):
def check_temps(self, h_temp, l_temp, dt, station):
try:
high = float(h_temp)
low = float(l_temp)
Expand All @@ -40,7 +40,7 @@ def check_temps(self, h_temp, l_temp, dt):
if high <= low:
raise ValueError
except ValueError:
print(f"Station Data incorrect for date: {dt}")
print(f"Station Data incorrect for date: {dt}, station: {station}")

return high, low

Expand Down

0 comments on commit 55ac15b

Please sign in to comment.