From bf4d91c7db985077c020f362d3a725c7e452837f Mon Sep 17 00:00:00 2001 From: "Fay.Liang" Date: Mon, 21 Jul 2014 12:51:31 -0400 Subject: [PATCH] ASM #15630 -- GFE: Missing ISC Wind Grids Change-Id: I289f1fafac8e034faa38dcddf639d5744fabe901 Former-commit-id: a5791db7cbbea5e60a83e8399f2cf0e99ab97ed2 [formerly db678db964b46a46e062cd0602cf9ce8bc96e4cd] Former-commit-id: 8de6be5219b267ed29e8298dd9d9fad5d3552031 --- .../edex_static/base/gfe/isc/iscMosaic.py | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py index 5fdd6066ac..b145b1189d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscMosaic.py @@ -38,6 +38,7 @@ from com.raytheon.uf.common.time import TimeRange from com.vividsolutions.jts.geom import Coordinate from java.awt import Point +from com.raytheon.edex.plugin.gfe.server import GridParmManager from com.raytheon.edex.plugin.gfe.config import IFPServerConfigManager from com.raytheon.edex.plugin.gfe.smartinit import IFPDB from com.raytheon.uf.common.dataplugin.gfe import GridDataHistory @@ -61,6 +62,7 @@ from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceID from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType from com.raytheon.uf.edex.database.cluster import ClusterLockUtils from com.raytheon.uf.edex.database.cluster import ClusterTask +from java.lang import System # # Port of iscMosaic.py @@ -80,13 +82,10 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask # 05/23/13 1759 dgilling Remove unnecessary imports. # 06/05/13 2063 dgilling Change __siteInDbGrid() to # call IFPWE.history() like A1. -# 09/05/13 2307 dgilling Fix breakage caused by #2044. -# 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys() # 11/05/13 2517 randerso Restructured logging so it coulde be used by WECache # Changed WECache to limit the number of cached grids kept in memory # 01/09/14 16952 randerso Fix regression made in #2517 which caused errors with overlapping grids # 02/04/14 17042 ryu Check in changes for randerso. -# 04/11/2014 17242 David Gillingham (code checked in by zhao) # BATCH_DELAY = 0.0 @@ -419,12 +418,18 @@ class WECache(object): elif gridType == "VECTOR": vecGrids = grid.__numpy__ return (vecGrids[0], vecGrids[1]) - elif gridType == "WEATHER" or gridType =="DISCRETE": + elif gridType == "WEATHER": keys = grid.getKeys() keyList = [] for theKey in keys: keyList.append(theKey.toString()) return (grid.__numpy__[0], keyList) + elif gridType == "DISCRETE": + keys = grid.getKey() + keyList = [] + for theKey in keys: + keyList.append(theKey.toString()) + return (grid.__numpy__[0], keyList) def __encodeGridHistory(self, histories): retVal = [] @@ -726,6 +731,9 @@ class IscMosaic: # process incoming grids for i in xrange(len(inTimes)): + # update cluster lock time to avoid time out + ClusterLockUtils.updateLockTime("ISC Write Lock", parmName , System.currentTimeMillis()) + # Put in a delay so we don't hammer the server so hard. if self.__gridDelay > 0.0: time.sleep(self.__gridDelay) @@ -747,7 +755,7 @@ class IscMosaic: grid = self.__validateAdjustWeatherKeys(grid, self.__parmName, tr) - grid = self.__remap(self.__dbwe, grid, inGeoDict, inFillV) + grid = self.__remap(self.__dbwe.getParmid(), grid, inGeoDict, inFillV) # if rate parm, then may need to adjust the values if self.__rateParm and inTimes[i] != tr: @@ -1224,12 +1232,13 @@ class IscMosaic: return grid.astype(numpy.float32) - def __remap(self, we, grid, inGeoDict, inFillV): - gpi = we.getGpi() + def __remap(self, pid, grid, inGeoDict, inFillV): + + gpi = GridParmManager.getGridParmInfo(pid).getPayload() gridType = gpi.getGridType().toString() - gs = self.__decodeGridSlice(we, grid, TimeRange()) + gs = self.__decodeGridSlice(pid, grid, TimeRange()) pd = self.__decodeProj(inGeoDict) fill = inFillV @@ -1259,10 +1268,9 @@ class IscMosaic: newGrid = mapper.remap(gs.getDiscreteGrid(), fill, fill) return (newGrid.__numpy__[0], grid[1]) - def __decodeGridSlice(self, we, value, tr, history=None): - pid = we.getParmid() - gpi = we.getGpi() + def __decodeGridSlice(self, pid, value, tr, history=None): + gpi = GridParmManager.getGridParmInfo(pid).getPayload() gridType = gpi.getGridType().toString() hist = ArrayList()