Merge "Omaha #4880 fix AvnFPS to not use strings for dates" into omaha_16.2.1

Former-commit-id: 6f1432da260860214f8e967662e9b5a258c41256
This commit is contained in:
Richard Peter 2015-09-14 12:58:56 -05:00 committed by Gerrit Code Review
commit 7917735a55

View file

@ -22,8 +22,7 @@
import PointDataView, PointDataContainer, NoDataException
#
# Python module to request point data. Split out of
# PointDataContainer.py.
# Python module to request point data. Split out of PointDataContainer.py.
#
#
# SOFTWARE HISTORY
@ -32,6 +31,7 @@ import PointDataView, PointDataContainer, NoDataException
# ------------ ---------- ----------- --------------------------
# 05/11/11 njensen Initial Creation.
# 25Apr2012 14688 rferrel Made into an abstract class.
# Sep 14, 2015 4880 njensen Improved __queryNewestRefTime()
#
#
#
@ -73,19 +73,21 @@ class PointDataRetrieve(object):
def __queryNewestRefTime(self):
from com.raytheon.uf.viz.core.catalog import CatalogQuery
from java.util import Arrays
from com.raytheon.uf.common.time import DataTime
results = CatalogQuery.performQuery('dataTime.refTime', self._buildConstraints(None))
Arrays.sort(results)
if len(results) == 0:
if self.site:
constraints = self._buildConstraints()
results = CatalogQuery.performTimeQuery(constraints, True, None)
nResults = len(results)
if nResults != 1:
if nResults > 1:
# this should be impossible to hit unless CatalogQuery is broken
raise NoDataException.NoDataException("Unable to determine latest time, received multiple times")
elif self.site:
raise NoDataException.NoDataException("No data available for site " + self.site)
else:
raise NoDataException.NoDataException("No data available")
dt = DataTime(results[len(results)-1])
dt = results[0]
return dt.getRefTime().getTime() / 1000
def _buildConstraints(self, refTime):
def _buildConstraints(self, refTime=None):
from java.util import HashMap
from com.raytheon.uf.common.dataquery.requests import RequestConstraint
queryTerms = HashMap()