Normally, this method is used to add a new station to an existing location. However, it also checks to see that the station code is not duplicated within the location.
# - - - L o c a t i o n . a d d S t a t i o n - - -
def addStation ( self, station ):
"""Add a new station to this location.
"""
#-- 1 --
# [ if self.staCodeMap has a key that matches
# station.staCode ->
# raise IOError
# else -> I ]
try:
oldSta = self.staCodeMap[station.staCode]
raise IOError, ( "Station code %s duplicates an "
"existing station in %s: %s." %
(station.staCode, self.locCode, oldSta) )
except KeyError:
pass
#-- 2 --
self.staCodeMap[station.staCode] = station