diff --git a/filter.py b/filter.py index 9b52993..ac93f83 100644 --- a/filter.py +++ b/filter.py @@ -1,4 +1,5 @@ import xml.etree.ElementTree as ET +from math import isnan class XMLFilter: """ @@ -69,8 +70,8 @@ def is_observable(self): bool: True if observable, False otherwise """ dec = float(self.get_text('C2')) - return dec >= self.observable_dec_threshold - + return dec >= self.observable_dec_threshold and not isnan(dec) and dec <= 90 + def get_location_status(self): """ Get a human-readable status of the event's observability. @@ -80,7 +81,7 @@ def get_location_status(self): """ if self.is_observable(): return 'The event should be observable.' - return 'The event is below the observable Declination.' + return 'The event is outside the observable Declination.' def get_event_data(self): """