mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-24 06:57:56 -05:00
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
#
|
|
# Implements IData for use by native Python clients to the Data Access
|
|
# Framework.
|
|
#
|
|
#
|
|
# SOFTWARE HISTORY
|
|
#
|
|
# Date Ticket# Engineer Description
|
|
# ------------ ---------- ----------- --------------------------
|
|
# 06/03/13 dgilling Initial Creation.
|
|
# 10/05/18 mjames@ucar Encode/decode attribute names.
|
|
#
|
|
#
|
|
|
|
from awips.dataaccess import IData
|
|
import six
|
|
|
|
class PyData(IData):
|
|
|
|
def __init__(self, dataRecord):
|
|
self.__time = dataRecord.getTime()
|
|
self.__level = dataRecord.getLevel()
|
|
self.__locationName = dataRecord.getLocationName()
|
|
self.__attributes = dataRecord.getAttributes()
|
|
|
|
def getAttribute(self, key):
|
|
value = self.__attributes[key]
|
|
return value
|
|
|
|
def getAttributes(self):
|
|
return list(self.__attributes.keys())
|
|
|
|
def getDataTime(self):
|
|
return self.__time
|
|
|
|
def getLevel(self):
|
|
if six.PY2:
|
|
return self.__level
|
|
if type(self.__level) is not str:
|
|
return self.__level.decode('utf-8')
|
|
return self.__level
|
|
|
|
def getLocationName(self):
|
|
return self.__locationName
|