35 from .
import antennaprofileevent_pb2
41 self.
_event = antennaprofileevent_pb2.AntennaProfileEvent()
48 profile = self.
_event.profiles.add()
52 for (name,value)
in list(kwargs.items()):
55 if isinstance(value,int):
57 profile.profileId = value
59 raise ValueError(
"profile must be an integer")
61 elif name ==
'azimuth':
62 if isinstance(value,int)
or \
63 isinstance(value,float):
65 profile.antennaAzimuthDegrees = value
67 raise ValueError(
"azimuth must be numeric")
69 elif name ==
'elevation':
70 if isinstance(value,int)
or \
71 isinstance(value,float):
73 profile.antennaElevationDegrees = value
75 raise ValueError(
"elevation must be numeric")
78 raise KeyError(
"unknown parameter: %s" % name)
80 if not (hasProfile
and hasAzimuth
and hasElevation):
81 raise KeyError(
"must specify profile, azimuth and elevation")
85 return self.
_event.SerializeToString()
88 self.
_event.ParseFromString(data)
91 for profile
in self.
_event.profiles:
92 kwargs = {
'profile': profile.profileId,
93 'azimuth' : profile.antennaAzimuthDegrees,
94 'elevation' : profile.antennaElevationDegrees}
96 yield (profile.nemId,kwargs)
def append(self, nemId, kwargs)