Skip to content

Commit

Permalink
Added application ID support to ProtectedEntityTVStation (an optional
Browse files Browse the repository at this point in the history
parameter).
  • Loading branch information
kate-harrison committed Sep 18, 2014
1 parent 6f2ba23 commit 9701c48
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 5 additions & 2 deletions protected_entities_tv_stations.py
Expand Up @@ -183,8 +183,7 @@ def convert_dms_to_decimal(degrees, minutes, seconds):
# Add optional information
new_station.add_facility_id(station['facility_id'])
new_station.add_callsign(station['fac_callsign'])

new_station._application_id_number = station['app_id']
new_station.add_app_id(station['app_id'])

self._add_entity(new_station)

Expand Down Expand Up @@ -228,6 +227,7 @@ def _load_entities(self):
column_number['lon_min'] = 25
column_number['lon_sec'] = 26
column_number['km_offset'] = 28
column_number['app_id'] = -3

def convert_dms_to_decimal(degrees, minutes, seconds):
return degrees + minutes/60 + seconds/3600
Expand Down Expand Up @@ -322,6 +322,8 @@ def convert_dms_to_decimal(degrees, minutes, seconds):
new_station.add_facility_id(station_row[column_number['facility_id']].strip())
new_station.add_callsign(callsign)

new_station.add_app_id(station_row[column_number['app_id']].strip())

# Add it to the internal list
self._add_entity(new_station)

Expand Down Expand Up @@ -391,5 +393,6 @@ def _load_entities(self):
# Add optional information
new_station.add_facility_id(station['facility_id'])
new_station.add_callsign(station['uid'])
new_station.add_app_id(station['application_id'])

self._add_entity(new_station)
13 changes: 12 additions & 1 deletion protected_entity_tv_station.py
Expand Up @@ -4,7 +4,8 @@
class ProtectedEntityTVStation(ProtectedEntity):
"""TV station"""

required_properties = ["_latitude", "_longitude", "_channel", "_ERP_Watts", "_HAAT_meters", "_tx_type"]
required_properties = ["_latitude", "_longitude", "_channel", "_ERP_Watts", "_HAAT_meters", "_tx_type",
"_facility_id", "_callsign", "_app_id"]

def __init__(self, container, region, latitude, longitude, channel, ERP_Watts, HAAT_meters, tx_type):
super(ProtectedEntityTVStation, self).__init__(region, container, latitude, longitude)
Expand All @@ -23,6 +24,7 @@ def __init__(self, container, region, latitude, longitude, channel, ERP_Watts, H
# Optional information that can be added later
self._facility_id = None
self._callsign = None
self._app_id = None

self._log_error_if_necessary_data_missing()

Expand All @@ -37,6 +39,7 @@ def to_string(self):
output += "ERP (kW): %.2f" % (self._ERP_Watts/1000) + "\t"
output += "HAAT (m): %f" % self._HAAT_meters + "\n"
output += "Callsign: %s" % str(self._callsign) + "\n"
output += "Application ID: %s" % str(self.get_app_id()) + "\n"

return output

Expand All @@ -63,6 +66,14 @@ def get_callsign(self):
Returns a string containing the callsign associated with the TV station (if any) or None.
"""

def add_app_id(self, app_id):
"""Add the application ID associated with the TV station."""
self._app_id = app_id

def get_app_id(self):
"""Returns a string containing the application ID associated with this TV station (if any) or None."""
return self._app_id

def get_location(self):
return (self._latitude, self._longitude)

Expand Down

0 comments on commit 9701c48

Please sign in to comment.