Merge "Issue #2508 Restore DiscreteGridSlice.setKey method used by iscMosaic." into omaha_14.2.1
Former-commit-id:dacdddf403
[formerly90a2c83c8e
] [formerlyb8a33ecdf8
] [formerly41b081307c
[formerlyb8a33ecdf8
[formerly dded4c12d27baede94b789d288d6bcb39e777f9f]]] Former-commit-id:41b081307c
Former-commit-id: 093ac09bf206a0017a0e5d3a730bba837dde43a2 [formerlya35a46de1b
] Former-commit-id:76965c12dd
This commit is contained in:
commit
ab5ab0ebe3
3 changed files with 44 additions and 7 deletions
|
@ -843,7 +843,7 @@ def storeVectorWE(we, trList, file, timeRange,
|
|||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del overlappingTimes[i]
|
||||
del timeList[i]
|
||||
elif we.getGpi().isRateParm():
|
||||
durRatio = (float(timeList[i][1]-timeList[i][0]))/float((ot[1]-ot[0]))
|
||||
|
@ -996,7 +996,7 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del overlappingTimes[i]
|
||||
del timeList[i]
|
||||
|
||||
# make the variable name
|
||||
|
@ -1081,7 +1081,7 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea):
|
|||
for i in xrange(len(overlappingTimes) -1, -1, -1):
|
||||
ot = overlappingTimes[i]
|
||||
if not ot in histDict:
|
||||
del overlappingTime[i]
|
||||
del overlappingTimes[i]
|
||||
del timeList[i]
|
||||
|
||||
# make the variable name
|
||||
|
|
|
@ -84,6 +84,7 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask
|
|||
# 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
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -462,6 +463,7 @@ class IscMosaic:
|
|||
self.__mysite = args['siteID']
|
||||
self.__userID = args['userID']
|
||||
self.__db = None # ifpServer database object
|
||||
self.__dbGrid = None
|
||||
self.__parmsToProcess = args['parmsToProcess']
|
||||
self.__blankOtherPeriods = args['blankOtherPeriods']
|
||||
self.__altMask = args['altMask']
|
||||
|
@ -823,7 +825,7 @@ class IscMosaic:
|
|||
|
||||
logger.debug("Merge: %s %s %s", printTR(m[0]),
|
||||
printTR(m[1]), m[2])
|
||||
gotGrid = self._wec[m[0]]
|
||||
gotGrid = self.__getDbGrid(m[0])
|
||||
|
||||
if gotGrid is not None:
|
||||
destGrid = gotGrid[0]
|
||||
|
@ -888,6 +890,30 @@ class IscMosaic:
|
|||
self._wec[tr] = None
|
||||
self.__dbinv = self._wec.keys()
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# get db grid
|
||||
# Gets the needed database grid
|
||||
# tr = desired grid, identified by time range
|
||||
# Returns tuple of (grid, history) (or None if unknown)
|
||||
#---------------------------------------------------------------------
|
||||
def __getDbGrid(self, tr):
|
||||
if tr is None:
|
||||
return None
|
||||
|
||||
if self.__dbGrid is None or tr != self.__dbGrid[2]:
|
||||
self.__dbGrid = None
|
||||
#grid = self.__dbwe.getGridAndHist(tr)
|
||||
grid = self._wec[tr]
|
||||
if grid is not None:
|
||||
destGrid, history = grid
|
||||
self.__dbGrid = (destGrid, history, tr)
|
||||
else:
|
||||
self.logProblem("Unable to access grid for ",
|
||||
self.__printTR(tr), "for ", self.__parmName)
|
||||
return None
|
||||
|
||||
return (self.__dbGrid[0], self.__dbGrid[1])
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# calculate file start/end processing times
|
||||
# Returns (startTime, endTime) or None for processing
|
||||
|
@ -1107,7 +1133,7 @@ class IscMosaic:
|
|||
for m in mergeInfo:
|
||||
if m[0] != m[1]: #split grid needed
|
||||
if m[0] != oldTR:
|
||||
oldGrid = self._wec[m[0]]
|
||||
oldGrid = self.__getDbGrid(m[0])
|
||||
oldTR = m[0]
|
||||
if oldGrid is not None:
|
||||
if self.__rateParm:
|
||||
|
@ -1116,8 +1142,9 @@ class IscMosaic:
|
|||
self.__storeGrid(m[1], (adjGrid, oldGrid[1]))
|
||||
else:
|
||||
self.__storeGrid(m[1], oldGrid)
|
||||
self.__dbGrid = None
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------
|
||||
# Get Incoming netCDF file grid valid times
|
||||
# netCDFfile, var is the netCDF variable
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -1395,7 +1422,7 @@ class IscMosaic:
|
|||
if m[0] != None and m[2] == 1:
|
||||
if self.__siteInDbGrid(m[0]):
|
||||
try:
|
||||
(destGrid, oldHist) = self._wec[m[0]]
|
||||
(destGrid, oldHist) = self.__getDbGrid(m[0])
|
||||
except:
|
||||
destGrid = None
|
||||
oldHist = None
|
||||
|
@ -1611,6 +1638,7 @@ class IscMosaic:
|
|||
#---------------------------------------------------------------------
|
||||
def __eraseAllGrids(self, processTimePeriod):
|
||||
self.__storeGrid(processTimePeriod, None)
|
||||
self.__dbGrid = None
|
||||
|
||||
|
||||
def convertList(unknownList):
|
||||
|
|
|
@ -802,6 +802,15 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable {
|
|||
this.keys = keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by iscMosaic.py
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public void setKey(List<DiscreteKey[]> key) {
|
||||
setKeys(key.toArray(new DiscreteKey[] {}));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keys
|
||||
* the keys to set
|
||||
|
|
Loading…
Add table
Reference in a new issue