dynamicserialize ncep_15.1.1-n -> ncep_16.1.4-n

This commit is contained in:
mjames-upc 2016-03-24 16:37:03 -05:00
parent 4491987304
commit fe36f7d43f
30 changed files with 852 additions and 196 deletions

View file

@ -1,19 +1,19 @@
## ##
# This software was developed and / or modified by Raytheon Company, # This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government. # pursuant to Contract DG133W-05-CQ-1067 with the US Government.
# #
# U.S. EXPORT CONTROLLED TECHNICAL DATA # U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose # This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination # export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires # to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization. # an export license or other authorization.
# #
# Contractor Name: Raytheon Company # Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340 # Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8 # Mail Stop B8
# Omaha, NE 68106 # Omaha, NE 68106
# 402.291.0100 # 402.291.0100
# #
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
@ -39,6 +39,7 @@ from struct import pack, unpack
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 11/11/09 chammack Initial Creation. # 11/11/09 chammack Initial Creation.
# 06/09/10 njensen Added float, list methods # 06/09/10 njensen Added float, list methods
# Apr 24, 2015 4425 nabowle Add F64List support.
# #
# #
# #
@ -52,6 +53,7 @@ floatList = numpy.dtype(numpy.float32).newbyteorder('>')
longList = numpy.dtype(numpy.int64).newbyteorder('>') longList = numpy.dtype(numpy.int64).newbyteorder('>')
shortList = numpy.dtype(numpy.int16).newbyteorder('>') shortList = numpy.dtype(numpy.int16).newbyteorder('>')
byteList = numpy.dtype(numpy.int8).newbyteorder('>') byteList = numpy.dtype(numpy.int8).newbyteorder('>')
doubleList = numpy.dtype(numpy.float64).newbyteorder('>')
class SelfDescribingBinaryProtocol(TBinaryProtocol): class SelfDescribingBinaryProtocol(TBinaryProtocol):
@ -95,6 +97,11 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol):
val = numpy.frombuffer(buff, dtype=floatList, count=sz) val = numpy.frombuffer(buff, dtype=floatList, count=sz)
return val return val
def readF64List(self, sz):
buff = self.trans.readAll(8*sz)
val = numpy.frombuffer(buff, dtype=doubleList, count=sz)
return val
def readI64List(self, sz): def readI64List(self, sz):
buff = self.trans.readAll(8*sz) buff = self.trans.readAll(8*sz)
val = numpy.frombuffer(buff, dtype=longList, count=sz) val = numpy.frombuffer(buff, dtype=longList, count=sz)
@ -118,6 +125,10 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol):
b = numpy.asarray(buff, floatList) b = numpy.asarray(buff, floatList)
self.trans.write(numpy.getbuffer(b)) self.trans.write(numpy.getbuffer(b))
def writeF64List(self, buff):
b = numpy.asarray(buff, doubleList)
self.trans.write(numpy.getbuffer(b))
def writeI64List(self, buff): def writeI64List(self, buff):
b = numpy.asarray(buff, longList) b = numpy.asarray(buff, longList)
self.trans.write(numpy.getbuffer(b)) self.trans.write(numpy.getbuffer(b))
@ -129,4 +140,3 @@ class SelfDescribingBinaryProtocol(TBinaryProtocol):
def writeI8List(self, buff): def writeI8List(self, buff):
b = numpy.asarray(buff, byteList) b = numpy.asarray(buff, byteList)
self.trans.write(numpy.getbuffer(b)) self.trans.write(numpy.getbuffer(b))

View file

@ -36,7 +36,7 @@
# 06/09/10 njensen Initial Creation. # 06/09/10 njensen Initial Creation.
# 06/12/13 #2099 dgilling Implement readObject() and # 06/12/13 #2099 dgilling Implement readObject() and
# writeObject(). # writeObject().
# 03/18/16 mjames@ucar Add types.UnicodeType # Apr 24, 2015 4425 nabowle Add Double support
# #
# #
@ -66,7 +66,6 @@ buildObjMap(dstypes)
pythonToThriftMap = { pythonToThriftMap = {
types.StringType: TType.STRING, types.StringType: TType.STRING,
types.UnicodeType: TType.STRING,
types.IntType: TType.I32, types.IntType: TType.I32,
types.LongType: TType.I64, types.LongType: TType.I64,
types.ListType: TType.LIST, types.ListType: TType.LIST,
@ -88,7 +87,7 @@ pythonToThriftMap = {
numpy.int64: TType.I64 numpy.int64: TType.I64
} }
primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64, SelfDescribingBinaryProtocol.FLOAT) primitiveSupport = (TType.BYTE, TType.I16, TType.I32, TType.I64, SelfDescribingBinaryProtocol.FLOAT, TType.DOUBLE)
class ThriftSerializationContext(object): class ThriftSerializationContext(object):
@ -130,14 +129,16 @@ class ThriftSerializationContext(object):
TType.I16: self.protocol.readI16List, TType.I16: self.protocol.readI16List,
TType.I32: self.protocol.readI32List, TType.I32: self.protocol.readI32List,
TType.I64: self.protocol.readI64List, TType.I64: self.protocol.readI64List,
SelfDescribingBinaryProtocol.FLOAT: self.protocol.readF32List SelfDescribingBinaryProtocol.FLOAT: self.protocol.readF32List,
TType.DOUBLE: self.protocol.readF64List
} }
self.listSerializationMethod = { self.listSerializationMethod = {
TType.BYTE: self.protocol.writeI8List, TType.BYTE: self.protocol.writeI8List,
TType.I16: self.protocol.writeI16List, TType.I16: self.protocol.writeI16List,
TType.I32: self.protocol.writeI32List, TType.I32: self.protocol.writeI32List,
TType.I64: self.protocol.writeI64List, TType.I64: self.protocol.writeI64List,
SelfDescribingBinaryProtocol.FLOAT: self.protocol.writeF32List SelfDescribingBinaryProtocol.FLOAT: self.protocol.writeF32List,
TType.DOUBLE: self.protocol.writeF64List
} }
@ -239,7 +240,7 @@ class ThriftSerializationContext(object):
return result return result
def _lookupType(self, obj): def _lookupType(self, obj):
pyt = type(obj) # <type 'unicode'> for h5py 2.0+ pyt = type(obj)
if pythonToThriftMap.has_key(pyt): if pythonToThriftMap.has_key(pyt):
return pythonToThriftMap[pyt] return pythonToThriftMap[pyt]
elif pyt.__module__.startswith('dynamicserialize.dstypes'): elif pyt.__module__.startswith('dynamicserialize.dstypes'):

View file

@ -0,0 +1,51 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# Adapter for com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress
#
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation
#
#
#
from thrift.Thrift import TType
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.svcbu import JobProgress
ClassAdapter = 'com.raytheon.uf.common.dataplugin.gfe.svcbu.JobProgress'
def serialize(context, mode):
context.protocol.writeFieldBegin('__enumValue__', TType.STRING, 0)
context.writeString(mode.value)
def deserialize(context):
result = JobProgress()
# Read the TType.STRING, "__enumValue__", and id.
# We're not interested in any of those, so just discard them.
context.protocol.readFieldBegin()
# now get the actual enum value
result.value = context.readString()
return result

View file

@ -31,7 +31,7 @@
# 03/20/13 #1774 randerso Added TimeConstraintsAdapter # 03/20/13 #1774 randerso Added TimeConstraintsAdapter
# 04/22/13 #1949 rjpeter Added LockTableAdapter # 04/22/13 #1949 rjpeter Added LockTableAdapter
# 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter # 02/06/14 #2672 bsteffen Added JTSEnvelopeAdapter
# 06/22/2015 #4573 randerso Added JobProgressAdapter
# #
# #
@ -56,8 +56,8 @@ __all__ = [
'ByteBufferAdapter', 'ByteBufferAdapter',
'TimeConstraintsAdapter', 'TimeConstraintsAdapter',
'LockTableAdapter', 'LockTableAdapter',
'JTSEnvelopeAdapter' 'JTSEnvelopeAdapter',
# 'GridDataHistoryAdapter', 'JobProgressAdapter',
] ]
classAdapterRegistry = {} classAdapterRegistry = {}
@ -80,5 +80,6 @@ def getAdapterRegistry():
raise LookupError('Adapter class ' + x + ' has no ClassAdapter field ' + \ raise LookupError('Adapter class ' + x + ' has no ClassAdapter field ' + \
'and cannot be registered.') 'and cannot be registered.')
getAdapterRegistry() getAdapterRegistry()

View file

@ -27,6 +27,7 @@
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 06/04/13 #2023 dgilling Initial Creation. # 06/04/13 #2023 dgilling Initial Creation.
# 01/06/14 #2537 bsteffen Store geometry index instead of WKT. # 01/06/14 #2537 bsteffen Store geometry index instead of WKT.
# 06/30/15 #4569 nabowle Rename *WKT* to *WKB*.
# #
# #
@ -38,7 +39,7 @@ class GeometryResponseData(AbstractResponseData):
def __init__(self): def __init__(self):
super(GeometryResponseData, self).__init__() super(GeometryResponseData, self).__init__()
self.dataMap = None self.dataMap = None
self.geometryWKTindex = None self.geometryWKBindex = None
def getDataMap(self): def getDataMap(self):
return self.dataMap return self.dataMap
@ -46,8 +47,8 @@ class GeometryResponseData(AbstractResponseData):
def setDataMap(self, dataMap): def setDataMap(self, dataMap):
self.dataMap = dataMap self.dataMap = dataMap
def getGeometryWKTindex(self): def getGeometryWKBindex(self):
return self.geometryWKTindex return self.geometryWKBindex
def setGeometryWKTindex(self, geometryWKTindex): def setGeometryWKBindex(self, geometryWKBindex):
self.geometryWKTindex = geometryWKTindex self.geometryWKBindex = geometryWKBindex

View file

@ -23,14 +23,14 @@
class GetGeometryDataResponse(object): class GetGeometryDataResponse(object):
def __init__(self): def __init__(self):
self.geometryWKTs = None self.geometryWKBs = None
self.geoData = None self.geoData = None
def getGeometryWKTs(self): def getGeometryWKBs(self):
return self.geometryWKTs return self.geometryWKBs
def setGeometryWKTs(self, geometryWKTs): def setGeometryWKBs(self, geometryWKBs):
self.geometryWKTs = geometryWKTs self.geometryWKBs = geometryWKBs
def getGeoData(self): def getGeoData(self):
return self.geoData return self.geoData

View file

@ -17,8 +17,14 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# File auto-generated by PythonFileGenerator # SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Added svcbu package
#
##
__all__ = [ __all__ = [
'GridDataHistory', 'GridDataHistory',
@ -29,6 +35,7 @@ __all__ = [
'request', 'request',
'server', 'server',
'slice', 'slice',
'svcbu',
'weather' 'weather'
] ]

View file

@ -28,7 +28,7 @@
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# xx/xx/?? dgilling Initial Creation. # xx/xx/?? dgilling Initial Creation.
# 03/13/13 1759 dgilling Add software history header. # 03/13/13 1759 dgilling Add software history header.
# # 05/13/15 4427 dgilling Add siteIdOverride field.
# #
# #
@ -40,7 +40,7 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest):
def __init__(self, outputFilename=None, parmList=[], databaseID=None, def __init__(self, outputFilename=None, parmList=[], databaseID=None,
startTime=None, endTime=None, mask=None, geoInfo=False, startTime=None, endTime=None, mask=None, geoInfo=False,
compressFile=False, configFileName=None, compressFileFactor=0, compressFile=False, configFileName=None, compressFileFactor=0,
trim=False, krunch=False, userID=None, logFileName=None): trim=False, krunch=False, userID=None, logFileName=None, siteIdOverride=None):
super(ExecuteIfpNetCDFGridRequest, self).__init__() super(ExecuteIfpNetCDFGridRequest, self).__init__()
self.outputFilename = outputFilename self.outputFilename = outputFilename
self.parmList = parmList self.parmList = parmList
@ -56,6 +56,7 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest):
self.krunch = krunch self.krunch = krunch
self.userID = userID self.userID = userID
self.logFileName = logFileName self.logFileName = logFileName
self.siteIdOverride = siteIdOverride
if self.userID is not None: if self.userID is not None:
self.workstationID = WsId(progName='ifpnetCDF', userName=self.userID) self.workstationID = WsId(progName='ifpnetCDF', userName=self.userID)
if self.databaseID is not None: if self.databaseID is not None:
@ -78,7 +79,9 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest):
retVal += "trim: " + str(self.trim) + ", " retVal += "trim: " + str(self.trim) + ", "
retVal += "krunch: " + str(self.krunch) + ", " retVal += "krunch: " + str(self.krunch) + ", "
retVal += "userID: " + str(self.userID) + ", " retVal += "userID: " + str(self.userID) + ", "
retVal += "logFileName: " + str(self.logFileName) + "]" retVal += "logFileName: " + str(self.logFileName) + ", "
retVal += "siteIdOverride: " + str(self.siteIdOverride)
retVal += "]"
return retVal return retVal
def __repr__(self): def __repr__(self):
@ -98,7 +101,9 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest):
retVal += "trim=" + repr(self.trim) + ", " retVal += "trim=" + repr(self.trim) + ", "
retVal += "krunch=" + repr(self.krunch) + ", " retVal += "krunch=" + repr(self.krunch) + ", "
retVal += "userID=" + repr(self.userID) + ", " retVal += "userID=" + repr(self.userID) + ", "
retVal += "logFileName=" + repr(self.logFileName) + ")" retVal += "logFileName=" + repr(self.logFileName) + ", "
retVal += "siteIdOverride: " + str(self.siteIdOverride)
retVal += ")"
return retVal return retVal
def getOutputFilename(self): def getOutputFilename(self):
@ -185,3 +190,8 @@ class ExecuteIfpNetCDFGridRequest(AbstractGfeRequest):
def setLogFileName(self, logFileName): def setLogFileName(self, logFileName):
self.logFileName = logFileName self.logFileName = logFileName
def getSiteIdOverride(self):
return self.siteIdOverride
def setSiteIdOverride(self, siteIdOverride):
self.siteIdOverride = siteIdOverride

View file

@ -17,33 +17,21 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Jul 15, 2015 #4013 randerso Initial creation (hand generated)
#
#
# File auto-generated against equivalent DynamicSerialize Java class from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import AbstractGfeRequest
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.slice import AbstractGridSlice
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.weather import WeatherKey
class PythonWeatherGridSlice(AbstractGridSlice): class RsyncGridsToCWFRequest(AbstractGfeRequest):
def __init__(self): def __init__(self, siteId=None):
super(PythonWeatherGridSlice, self).__init__() super(RsyncGridsToCWFRequest, self).__init__()
self.weatherGrid = None if siteId is not None:
self.keys = [] self.siteID = str(siteId)
def getNumPyGrid(self):
return (self.weatherGrid.getNumPyGrid(), self.keys)
def getWeatherGrid(self):
return self.weatherGrid
def setWeatherGrid(self, weatherGrid):
self.weatherGrid = weatherGrid
def getKeys(self):
return self.keys
def setKeys(self, keys):
del self.keys[:]
for key in keys:
self.keys.append(WeatherKey(subKeys=key))

View file

@ -17,8 +17,13 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# File auto-generated by PythonFileGenerator # SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Jul 15, 2015 #4013 randerso Added RsyncGridsToCWFRequest
#
__all__ = [ __all__ = [
'AbstractGfeRequest', 'AbstractGfeRequest',
@ -45,8 +50,8 @@ __all__ = [
'ProcessReceivedDigitalDataRequest', 'ProcessReceivedDigitalDataRequest',
'PurgeGfeGridsRequest', 'PurgeGfeGridsRequest',
'SaveASCIIGridsRequest', 'SaveASCIIGridsRequest',
'ServiceBackupStatusUpdateRequest', 'SmartInitRequest',
'SmartInitRequest' 'RsyncGridsToCWFRequest',
] ]
from AbstractGfeRequest import AbstractGfeRequest from AbstractGfeRequest import AbstractGfeRequest
@ -73,6 +78,6 @@ from ProcessReceivedConfRequest import ProcessReceivedConfRequest
from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest from ProcessReceivedDigitalDataRequest import ProcessReceivedDigitalDataRequest
from PurgeGfeGridsRequest import PurgeGfeGridsRequest from PurgeGfeGridsRequest import PurgeGfeGridsRequest
from SaveASCIIGridsRequest import SaveASCIIGridsRequest from SaveASCIIGridsRequest import SaveASCIIGridsRequest
from ServiceBackupStatusUpdateRequest import ServiceBackupStatusUpdateRequest
from SmartInitRequest import SmartInitRequest from SmartInitRequest import SmartInitRequest
from RsyncGridsToCWFRequest import RsyncGridsToCWFRequest

View file

@ -0,0 +1,53 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation (hand generated)
#
##
import GfeNotification
class CombinationsFileChangedNotification(GfeNotification.GfeNotification):
def __init__(self):
super(CombinationsFileChangedNotification, self).__init__()
self.combinationsFileName = None
self.whoChanged = None
def __str__(self):
msg = "fileName: " + str(self.combinationsFileName)
msg += '\n' + "whoChanged: " + str(self.whoChanged)
return msg
def getCombinationsFileName(self):
return self.combinationsFileName
def setCombinationsFileName(self, combinationsFileName):
self.combinationsFileName = combinationsFileName
def getWhoChanged(self):
return self.whoChanged
def setWhoChanged(self, whoChanged):
self.whoChanged = whoChanged

View file

@ -17,23 +17,25 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# ??/??/???? ???? njensen Modified to add __repr__
# 06/22/2015 4573 randerso Change to extend GfeNotification
# removed inventory methods
#
##
# File auto-generated against equivalent DynamicSerialize Java class import GfeNotification
# Modified by njensen to add __repr__
class DBInvChangeNotification(object): class DBInvChangeNotification(GfeNotification.GfeNotification):
def __init__(self): def __init__(self):
self.inventory = None super(DBInvChangeNotification, self).__init__()
self.additions = None self.additions = None
self.deletions = None self.deletions = None
self.siteID = None
def getInventory(self):
return self.inventory
def setInventory(self, inventory):
self.inventory = inventory
def getAdditions(self): def getAdditions(self):
return self.additions return self.additions
@ -47,15 +49,8 @@ class DBInvChangeNotification(object):
def setDeletions(self, deletions): def setDeletions(self, deletions):
self.deletions = deletions self.deletions = deletions
def getSiteID(self): def __str__(self):
return self.siteID msg = 'Additions' + str(self.additions) + '\n'
def setSiteID(self, siteID):
self.siteID = siteID
def __repr__(self):
msg = 'Inventory' + str(self.inventory) + '\n'
msg += 'Additions' + str(self.additions) + '\n'
msg += 'Deletions' + str(self.deletions) msg += 'Deletions' + str(self.deletions)
return msg return msg

View file

@ -15,11 +15,21 @@
# #
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/07/2014 3684 randerso Manually updated to add sourceID
#
##
import abc
# File auto-generated against equivalent DynamicSerialize Java class class GfeNotification(object):
__metaclass__ = abc.ABCMeta
class GfeNotification:
@abc.abstractmethod
def __init__(self): def __init__(self):
self.siteID = None self.siteID = None
self.sourceID = None self.sourceID = None

View file

@ -0,0 +1,61 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation (hand generated)
#
##
import GfeNotification
class GridHistoryUpdateNotification(GfeNotification.GfeNotification):
def __init__(self):
super(GridHistoryUpdateNotification, self).__init__()
self.parmId = None
self.workstationID = None
self.histories = None
def getParmId(self):
return self.parmId
def setParmId(self, parmId):
self.parmId = parmId
def getWorkstationID(self):
return self.workstationID
def setWorkstationID(self, workstationID):
self.workstationID = workstationID
def getHistories(self):
return self.histories
def setHistories(self, histories):
self.histories = histories
def __str__(self):
msg = "ParmID: " + str(self.parmId)
msg += '\n' + "Histories: " + str(self.histories)
return msg

View file

@ -17,17 +17,25 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# ??/??/???? ???? njensen Modified to add __repr__
# 06/22/2015 4573 randerso Change to extend GfeNotification
#
##
# File auto-generated against equivalent DynamicSerialize Java class import GfeNotification
# Modified by njensen to add __repr__
class GridUpdateNotification(object): class GridUpdateNotification(GfeNotification.GfeNotification):
def __init__(self): def __init__(self):
super(GridUpdateNotification, self).__init__()
self.parmId = None self.parmId = None
self.replacementTimeRange = None self.replacementTimeRange = None
self.workstationID = None self.workstationID = None
self.siteID = None
self.histories = None self.histories = None
def getParmId(self): def getParmId(self):
@ -48,12 +56,6 @@ class GridUpdateNotification(object):
def setWorkstationID(self, workstationID): def setWorkstationID(self, workstationID):
self.workstationID = workstationID self.workstationID = workstationID
def getSiteID(self):
return self.siteID
def setSiteID(self, siteID):
self.siteID = siteID
def getHistories(self): def getHistories(self):
return self.histories return self.histories
@ -61,9 +63,6 @@ class GridUpdateNotification(object):
self.histories = histories self.histories = histories
def __str__(self): def __str__(self):
return self.__repr__()
def __repr__(self):
msg = "ParmID: " + str(self.parmId) msg = "ParmID: " + str(self.parmId)
msg += '\n' + "Replacement TimeRange: " + str(self.replacementTimeRange) msg += '\n' + "Replacement TimeRange: " + str(self.replacementTimeRange)
msg += '\n' + "Histories: " + str(self.histories) msg += '\n' + "Histories: " + str(self.histories)

View file

@ -17,15 +17,23 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# ??/??/???? ???? njensen Modified to add __repr__
# 06/22/2015 4573 randerso Change to extend GfeNotification
#
##
# File auto-generated against equivalent DynamicSerialize Java class import GfeNotification
# Modified by njensen to add __repr__
class LockNotification(object): class LockNotification(GfeNotification.GfeNotification):
def __init__(self): def __init__(self):
super(LockNotification, self).__init__()
self.lockTable = None self.lockTable = None
self.siteID = None
def getLockTable(self): def getLockTable(self):
return self.lockTable return self.lockTable
@ -33,12 +41,6 @@ class LockNotification(object):
def setLockTable(self, lockTable): def setLockTable(self, lockTable):
self.lockTable = lockTable self.lockTable = lockTable
def getSiteID(self): def __str__(self):
return self.siteID
def setSiteID(self, siteID):
self.siteID = siteID
def __repr__(self):
return str(self.lockTable) return str(self.lockTable)

View file

@ -0,0 +1,53 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation (hand generated)
#
##
import GfeNotification
class ServiceBackupJobStatusNotification(GfeNotification.GfeNotification):
def __init__(self):
super(ServiceBackupJobStatusNotification, self).__init__()
self.name = None
self.state = "UNKNOWN"
def __str__(self):
msg = "name: " + str(self.name)
msg += '\n' + "state: " + str(self.state)
return msg
def getName(self):
return self.name
def setName(self, name):
self.name = name
def getState(self):
return self.state
def setState(self, state):
self.state = state

View file

@ -17,16 +17,24 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Change to extend GfeNotification
#
##
# File auto-generated against equivalent DynamicSerialize Java class import GfeNotification
class UserMessageNotification(object): class UserMessageNotification(GfeNotification.GfeNotification):
def __init__(self): def __init__(self):
super(UserMessageNotification, self).__init__()
self.category = None self.category = None
self.priority = None self.priority = None
self.message = None self.message = None
self.siteID = None
def getCategory(self): def getCategory(self):
return self.category return self.category
@ -46,13 +54,7 @@ class UserMessageNotification(object):
def setMessage(self, message): def setMessage(self, message):
self.message = message self.message = message
def getSiteID(self): def __str__(self):
return self.siteID
def setSiteID(self, siteID):
self.siteID = siteID
def __repr__(self):
msg = 'Message: ' + str(self.message) + '\n' msg = 'Message: ' + str(self.message) + '\n'
msg += 'Priority: ' + str(self.priority) + '\n' msg += 'Priority: ' + str(self.priority) + '\n'
msg += 'Category: ' + str(self.category) + '\n' msg += 'Category: ' + str(self.category) + '\n'

View file

@ -21,16 +21,22 @@
# File auto-generated by PythonFileGenerator # File auto-generated by PythonFileGenerator
__all__ = [ __all__ = [
'CombinationsFileChangedNotification',
'DBInvChangeNotification', 'DBInvChangeNotification',
'GfeNotification', 'GfeNotification',
'GridHistoryUpdateNotification',
'GridUpdateNotification', 'GridUpdateNotification',
'LockNotification', 'LockNotification',
'ServiceBackupJobStatusNotification',
'UserMessageNotification' 'UserMessageNotification'
] ]
from CombinationsFileChangedNotification import CombinationsFileChangedNotification
from DBInvChangeNotification import DBInvChangeNotification from DBInvChangeNotification import DBInvChangeNotification
from GfeNotification import GfeNotification from GfeNotification import GfeNotification
from GridHistoryUpdateNotification import GridHistoryUpdateNotification
from GridUpdateNotification import GridUpdateNotification from GridUpdateNotification import GridUpdateNotification
from LockNotification import LockNotification from LockNotification import LockNotification
from ServiceBackupJobStatusNotification import ServiceBackupJobStatusNotification
from UserMessageNotification import UserMessageNotification from UserMessageNotification import UserMessageNotification

View file

@ -23,7 +23,6 @@
__all__ = [ __all__ = [
'AbstractGridSlice', 'AbstractGridSlice',
'DiscreteGridSlice', 'DiscreteGridSlice',
'PythonWeatherGridSlice',
'ScalarGridSlice', 'ScalarGridSlice',
'VectorGridSlice', 'VectorGridSlice',
'WeatherGridSlice' 'WeatherGridSlice'
@ -32,7 +31,6 @@ __all__ = [
from AbstractGridSlice import AbstractGridSlice from AbstractGridSlice import AbstractGridSlice
from DiscreteGridSlice import DiscreteGridSlice from DiscreteGridSlice import DiscreteGridSlice
from ScalarGridSlice import ScalarGridSlice from ScalarGridSlice import ScalarGridSlice
from PythonWeatherGridSlice import PythonWeatherGridSlice
from VectorGridSlice import VectorGridSlice from VectorGridSlice import VectorGridSlice
from WeatherGridSlice import WeatherGridSlice from WeatherGridSlice import WeatherGridSlice

View file

@ -0,0 +1,37 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation (hand generated)
# 08/27/2015 4812 randerso Change __str__ to return the self.value
# instead of __repr__(self.value) to eliminate
# ''s around string.
#
##
class JobProgress(object):
def __init__(self):
self.value = None
def __str__(self):
return self.value

View file

@ -0,0 +1,33 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 06/22/2015 4573 randerso Initial creation (hand generated)
#
##
__all__ = [
'JobProgress',
]
from JobProgress import JobProgress

View file

@ -28,6 +28,8 @@
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation. # 05/29/13 2023 dgilling Initial Creation.
# 02/12/14 2672 bsteffen Allow String constructor to parse floats. # 02/12/14 2672 bsteffen Allow String constructor to parse floats.
# 06/29/15 4480 dgilling Implement __hash__, __eq__,
# __str__ and rich comparison operators.
# #
@ -58,6 +60,120 @@ class Level(object):
if levelTwo: if levelTwo:
self.leveltwovalue = numpy.float64(levelTwo) self.leveltwovalue = numpy.float64(levelTwo)
def __hash__(self):
# XOR-ing the 3 items in a tuple ensures that order of the
# values matters
hashCode = hash(self.masterLevel) ^ hash(self.levelonevalue) ^ hash(self.leveltwovalue)
hashCode ^= hash((self.masterLevel, self.levelonevalue, self.leveltwovalue))
return hashCode
def __eq__(self, other):
if type(self) != type(other):
return False
else:
return (self.masterLevel, self.levelonevalue, self.leveltwovalue) == \
(other.masterLevel, other.levelonevalue, other.leveltwovalue)
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other):
if type(self) != type(other):
return NotImplemented
elif self.masterLevel.getName() != other.masterLevel.getName():
return NotImplemented
myLevel1 = self.levelonevalue
myLevel2 = self.leveltwovalue
otherLevel1 = other.levelonevalue
otherLevel2 = other.leveltwovalue
if myLevel1 == INVALID_VALUE and myLevel2 != INVALID_VALUE:
myLevel1 = myLevel2
myLevel2 = INVALID_VALUE
if otherLevel1 == INVALID_VALUE and otherLevel2 != INVALID_VALUE:
otherLevel1 = otherLevel2
otherLevel2 = INVALID_VALUE
# We default to descending order to make sorting levels from the DAF easier
compareType = self.masterLevel.getType() if self.masterLevel.getType() else "DEC"
if myLevel1 != INVALID_VALUE and otherLevel1 != INVALID_VALUE:
level1Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel1)
if level1Cmp == -1:
if myLevel2 != INVALID_VALUE and otherLevel2 != INVALID_VALUE:
level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel2)
return level2Cmp == -1
elif myLevel2 != INVALID_VALUE:
level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel1)
return level2Cmp == -1
else:
return True
return False
def __le__(self, other):
if type(self) != type(other):
return NotImplemented
elif self.masterLevel.getName() != other.masterLevel.getName():
return NotImplemented
return self.__lt__(other) or self.__eq__(other)
def __gt__(self, other):
if type(self) != type(other):
return NotImplemented
elif self.masterLevel.getName() != other.masterLevel.getName():
return NotImplemented
myLevel1 = self.levelonevalue
myLevel2 = self.leveltwovalue
otherLevel1 = other.levelonevalue
otherLevel2 = other.leveltwovalue
if myLevel1 == INVALID_VALUE and myLevel2 != INVALID_VALUE:
myLevel1 = myLevel2
myLevel2 = INVALID_VALUE
if otherLevel1 == INVALID_VALUE and otherLevel2 != INVALID_VALUE:
otherLevel1 = otherLevel2
otherLevel2 = INVALID_VALUE
# We default to descending order to make sorting levels from the DAF easier
compareType = self.masterLevel.getType() if self.masterLevel.getType() else "DEC"
if myLevel1 != INVALID_VALUE and otherLevel1 != INVALID_VALUE:
level1Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel1)
if level1Cmp == 1:
if myLevel2 != INVALID_VALUE and otherLevel2 != INVALID_VALUE:
level2Cmp = self.__compareLevelValues(compareType, myLevel2, otherLevel2)
return level2Cmp == 1
elif otherLevel2 != INVALID_VALUE:
level2Cmp = self.__compareLevelValues(compareType, myLevel1, otherLevel2)
return level2Cmp == 1
else:
return True
return False
def __ge__(self, other):
if type(self) != type(other):
return NotImplemented
elif self.masterLevel.getName() != other.masterLevel.getName():
return NotImplemented
return self.__gt__(other) or self.__eq__(other)
def __compareLevelValues(self, compareType, val1, val2):
returnVal = 0
if val1 < val2:
returnVal = -1 if compareType == 'INC' else 1
elif val2 < val1:
returnVal = 1 if compareType == 'INC' else -1
return returnVal
def __str__(self):
retVal = ""
if INVALID_VALUE != self.levelonevalue:
retVal += str(self.levelonevalue)
if INVALID_VALUE != self.leveltwovalue:
retVal += "_" + str(self.leveltwovalue)
retVal += str(self.masterLevel.getName())
return retVal
def getId(self): def getId(self):
return self.id return self.id
@ -87,4 +203,3 @@ class Level(object):
def setIdentifier(self, identifier): def setIdentifier(self, identifier):
self.identifier = identifier self.identifier = identifier

View file

@ -27,6 +27,8 @@
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 05/29/13 2023 dgilling Initial Creation. # 05/29/13 2023 dgilling Initial Creation.
# 06/29/15 4480 dgilling Implement __hash__, __eq__
# and __str__.
# #
# #
@ -39,6 +41,27 @@ class MasterLevel(object):
self.type = None self.type = None
self.identifier = None self.identifier = None
def __hash__(self):
return hash(self.name)
def __eq__(self, other):
if type(self) != type(other):
return False
else:
return self.name == other.name
def __ne__(self, other):
return not self.__eq__(other)
def __str__(self):
retVal = "MasterLevel["
retVal += "name=" + str(self.name) + ","
retVal += "type=" + str(self.type) + ","
retVal += "unit=" + str(self.unitString) + ","
retVal += "description=" + str(self.description)
retVal += "]"
return retVal
def getName(self): def getName(self):
return self.name return self.name

View file

@ -0,0 +1,116 @@
##
# This software was developed and / or modified by Raytheon Company,
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
#
# U.S. EXPORT CONTROLLED TECHNICAL DATA
# This software product contains export-restricted data whose
# export/transfer/disclosure is restricted by U.S. law. Dissemination
# to non-U.S. persons whether in the United States or abroad requires
# an export license or other authorization.
#
# Contractor Name: Raytheon Company
# Contractor Address: 6825 Pine Street, Suite 340
# Mail Stop B8
# Omaha, NE 68106
# 402.291.0100
#
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information.
##
# File auto-generated against equivalent DynamicSerialize Java class and
# modified.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Sep 8, 2014 kustert Initial Creation
# Apr 24, 2015 4425 nabowle Bring in.
class DoubleDataRecord(object):
def __init__(self):
self.sizes = None
self.dimension = None
self.maxChunkSize = None
self.name = None
self.fillValue = None
self.dataAttributes = None
self.group = None
self.minIndex = None
self.props = None
self.doubleData = None
self.maxSizes = None
def getSizes(self):
return self.sizes
def setSizes(self, sizes):
self.sizes = sizes
def getDimension(self):
return self.dimension
def setDimension(self, dimension):
self.dimension = dimension
def getMaxChunkSize(self):
return self.maxChunkSize
def setMaxChunkSize(self, maxChunkSize):
self.maxChunkSize = maxChunkSize
def getName(self):
return self.name
def setName(self, name):
self.name = name
def getFillValue(self):
return self.fillValue
def setFillValue(self, fillValue):
self.fillValue = fillValue
def getDataAttributes(self):
return self.dataAttributes
def setDataAttributes(self, dataAttributes):
self.dataAttributes = dataAttributes
def getGroup(self):
return self.group
def setGroup(self, group):
self.group = group
def getMinIndex(self):
return self.minIndex
def setMinIndex(self, minIndex):
self.minIndex = minIndex
def getProps(self):
return self.props
def setProps(self, props):
self.props = props
def getDoubleData(self):
return self.doubleData
def setDoubleData(self, doubleData):
self.doubleData = doubleData
def getMaxSizes(self):
return self.maxSizes
def setMaxSizes(self, maxSizes):
self.maxSizes = maxSizes
def retrieveDataObject(self):
return self.getDoubleData()
def putDataObject(self, obj):
self.setDoubleData(obj)

View file

@ -18,7 +18,6 @@
# further licensing information. # further licensing information.
## ##
# #
# Package definition for com.raytheon.uf.common.datastorage.records # Package definition for com.raytheon.uf.common.datastorage.records
# #
@ -27,24 +26,28 @@
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 08/31/10 njensen Initial Creation. # 08/31/10 njensen Initial Creation.
# Apr 24, 2015 4425 nabowle Add DoubleDataRecord
# #
# #
# #
__all__ = [ __all__ = [
'ByteDataRecord', 'ByteDataRecord',
'FloatDataRecord', 'DoubleDataRecord',
'IntegerDataRecord', 'FloatDataRecord',
'LongDataRecord', 'IntegerDataRecord',
'ShortDataRecord', 'LongDataRecord',
'StringDataRecord', 'ShortDataRecord',
] 'StringDataRecord'
]
from ByteDataRecord import ByteDataRecord from ByteDataRecord import ByteDataRecord
from DoubleDataRecord import DoubleDataRecord
from FloatDataRecord import FloatDataRecord from FloatDataRecord import FloatDataRecord
from IntegerDataRecord import IntegerDataRecord from IntegerDataRecord import IntegerDataRecord
from LongDataRecord import LongDataRecord from LongDataRecord import LongDataRecord
from ShortDataRecord import ShortDataRecord from ShortDataRecord import ShortDataRecord
from StringDataRecord import StringDataRecord from StringDataRecord import StringDataRecord

View file

@ -31,6 +31,9 @@
# 01/22/14 2667 bclement preserved milliseconds in string representation # 01/22/14 2667 bclement preserved milliseconds in string representation
# 03/03/14 2673 bsteffen allow construction using a Date for refTime # 03/03/14 2673 bsteffen allow construction using a Date for refTime
# 06/24/14 3096 mnash implement __cmp__ # 06/24/14 3096 mnash implement __cmp__
# 06/24/15 4480 dgilling implement __hash__ and __eq__,
# replace __cmp__ with rich comparison
# operators.
# #
import calendar import calendar
@ -66,9 +69,7 @@ class DataTime(object):
self.refTime = long(self.refTime.getTime()) self.refTime = long(self.refTime.getTime())
else: else:
self.refTime = long(refTime) self.refTime = long(refTime)
dateObj = Date() self.refTime = Date(self.refTime)
dateObj.setTime(self.refTime)
self.refTime = dateObj
if self.validPeriod is None: if self.validPeriod is None:
validTimeMillis = self.refTime.getTime() + long(self.fcstTime * 1000) validTimeMillis = self.refTime.getTime() + long(self.fcstTime * 1000)
@ -112,38 +113,6 @@ class DataTime(object):
def setLevelValue(self, levelValue): def setLevelValue(self, levelValue):
self.levelValue = numpy.float64(levelValue) self.levelValue = numpy.float64(levelValue)
def __cmp__(self, other):
if other is None :
return 1
# compare the valid times, which are the ref times + forecast times
validTimeCmp = cmp(self.getRefTime().getTime() + self.getFcstTime(),
other.getRefTime().getTime() + other.getFcstTime())
if validTimeCmp != 0 :
return validTimeCmp
# compare the forecast times
fcstTimeCmp = cmp(self.getFcstTime(), other.getFcstTime())
if fcstTimeCmp != 0 :
return fcstTimeCmp
# compare the level values
levelCmp = cmp(self.getLevelValue(), other.getLevelValue())
if levelValue != 0 :
return levelValue
# compare the valid periods
period1 = self.getValidPeriod()
period2 = other.getValidPerid()
if period1 is None :
return -1
elif period2 is None :
return 1
return cmp(period1.getDuration(), period2.getDuration())
def __str__(self): def __str__(self):
buffer = StringIO.StringIO() buffer = StringIO.StringIO()
@ -172,3 +141,86 @@ class DataTime(object):
strVal = buffer.getvalue() strVal = buffer.getvalue()
buffer.close() buffer.close()
return strVal return strVal
def __repr__(self):
return "<DataTime instance: " + str(self) + " >"
def __hash__(self):
hashCode = hash(self.refTime) ^ hash(self.fcstTime)
if self.validPeriod is not None and self.validPeriod.isValid():
hashCode ^= hash(self.validPeriod.getStart())
hashCode ^= hash(self.validPeriod.getEnd())
hashCode ^= hash(self.levelValue)
return hashCode
def __eq__(self, other):
if type(self) != type(other):
return False
if other.getRefTime() is None:
return self.fcstTime == other.fcstTime
dataTime1 = (self.refTime, self.fcstTime, self.validPeriod, self.levelValue)
dataTime2 = (other.refTime, other.fcstTime, other.validPeriod, other.levelValue)
return dataTime1 == dataTime2
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other):
if type(self) != type(other):
return NotImplemented
myValidTime = self.getRefTime().getTime() + self.getFcstTime()
otherValidTime = other.getRefTime().getTime() + other.getFcstTime()
if myValidTime < otherValidTime:
return True
if self.fcstTime < other.fcstTime:
return True
if self.levelValue < other.levelValue:
return True
myValidPeriod = self.validPeriod
otherValidPeriod = other.validPeriod
if myValidPeriod != otherValidPeriod:
if myValidPeriod.duration() < otherValidPeriod.duration():
return True
return myValidPeriod.getStartInMillis() < otherValidPeriod.getStartInMillis()
return False
def __le__(self, other):
if type(self) != type(other):
return NotImplemented
return self.__lt__(other) or self.__eq__(other)
def __gt__(self, other):
if type(self) != type(other):
return NotImplemented
myValidTime = self.getRefTime().getTime() + self.getFcstTime()
otherValidTime = other.getRefTime().getTime() + other.getFcstTime()
if myValidTime > otherValidTime:
return True
if self.fcstTime > other.fcstTime:
return True
if self.levelValue > other.levelValue:
return True
myValidPeriod = self.validPeriod
otherValidPeriod = other.validPeriod
if myValidPeriod != otherValidPeriod:
if myValidPeriod.duration() > otherValidPeriod.duration():
return True
return myValidPeriod.getStartInMillis() > otherValidPeriod.getStartInMillis()
return False
def __ge__(self, other):
if type(self) != type(other):
return NotImplemented
return self.__gt__(other) or self.__eq__(other)

View file

@ -28,6 +28,7 @@
# ??/??/?? xxxxxxxx Initial Creation. # ??/??/?? xxxxxxxx Initial Creation.
# 01/22/14 2667 bclement fixed millisecond support # 01/22/14 2667 bclement fixed millisecond support
# 02/28/14 2667 bclement constructor can take extra micros for start and end # 02/28/14 2667 bclement constructor can take extra micros for start and end
# 06/24/15 4480 dgilling fix __eq__.
# #
# #
# #
@ -51,7 +52,15 @@ class TimeRange(object):
return "(" + self.start.strftime("%b %d %y %H:%M:%S %Z") + ", " + self.end.strftime("%b %d %y %H:%M:%S %Z") + ")" return "(" + self.start.strftime("%b %d %y %H:%M:%S %Z") + ", " + self.end.strftime("%b %d %y %H:%M:%S %Z") + ")"
def __eq__(self, other): def __eq__(self, other):
return ((self.start == other.start) and (self.end == other.end)) if type(self) != type(other):
return False
if self.isValid() and other.isValid():
return self.getStart() == other.getStart() and self.getEnd() == other.getEnd()
elif not self.isValid() and not other.isValid():
return True
else:
return False
def __ne__(self, other): def __ne__(self, other):
return (not self.__eq__(other)) return (not self.__eq__(other))
@ -132,7 +141,7 @@ class TimeRange(object):
return convTime == self.start return convTime == self.start
def isValid(self): def isValid(self):
return (self.start != self.end) return bool(self.start != self.end)
def overlaps(self, timeRange): def overlaps(self, timeRange):
return (timeRange.contains(self.start) or self.contains(timeRange.start)) return (timeRange.contains(self.start) or self.contains(timeRange.start))

View file

@ -18,25 +18,22 @@
# further licensing information. # further licensing information.
## ##
## NOTE: This is a dummy class that is only used for deserialization # File auto-generated against equivalent DynamicSerialize Java class
## support. Further work required if it is need in the pure Python # and then modified post-generation to add additional features to better
## environment. # match Java implementation.
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# ??/??/?? xxxxxxxx Initial Creation.
# 06/24/15 4480 dgilling implement based on Date class.
#
class Timestamp(object): from dynamicserialize.dstypes.java.util import Date
class Timestamp(Date):
def __init__(self, time=None): def __init__(self, time=None):
self.time = time super(Timestamp, self).__init__(time)
def getTime(self):
return self.time
def setTime(self, timeInMillis):
self.time = timeInMillis
def __str__(self):
return self.__repr__()
def __repr__(self):
from time import gmtime, strftime
return strftime("%b %d %y %H:%M:%S GMT", gmtime(self.time/1000.0))

View file

@ -17,13 +17,24 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
# ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 04/28/2015 4027 randerso Added optional construction parameter to set the time
# 06/26/2015 4480 dgilling Implement __eq__ and __hash__.
#
##
from time import gmtime, strftime
# File auto-generated against equivalent DynamicSerialize Java class
class Date(object): class Date(object):
def __init__(self): def __init__(self, timeInMillis=None):
self.time = None self.time = timeInMillis
def getTime(self): def getTime(self):
return self.time return self.time
@ -35,6 +46,13 @@ class Date(object):
return self.__repr__() return self.__repr__()
def __repr__(self): def __repr__(self):
from time import gmtime, strftime
return strftime("%b %d %y %H:%M:%S GMT", gmtime(self.time/1000.0)) return strftime("%b %d %y %H:%M:%S GMT", gmtime(self.time/1000.0))
def __eq__(self, other):
return self.time == other.time
def __ne__(self, other):
return not self.__eq__(other)
def __hash__(self):
return hash(self.time)