Issue #851 Cleaned up unnecessary Java imports in baselined tools/procedures.
Change-Id: I49ad2815c2b524a63c115c1b2424b41831247d97 Former-commit-id:d3e0cd5af8
[formerlyd3e0cd5af8
[formerly ff032c53a059f25558aabdc5b483c4cc59ad3f6e]] Former-commit-id:e71059c2b9
Former-commit-id:473e6e9eb2
This commit is contained in:
parent
d519705a88
commit
34452f236e
11 changed files with 53 additions and 86 deletions
|
@ -22,6 +22,8 @@
|
||||||
from gfeConfig import *
|
from gfeConfig import *
|
||||||
import gfeConfig
|
import gfeConfig
|
||||||
|
|
||||||
|
HideConfigFile = 1
|
||||||
|
|
||||||
# Defines the T as the displayable weather element
|
# Defines the T as the displayable weather element
|
||||||
Png_parms = ['T_SFC:_Fcst -1', 'Td_SFC:_Fcst -1', 'Wind_SFC:_Fcst -1']
|
Png_parms = ['T_SFC:_Fcst -1', 'Td_SFC:_Fcst -1', 'Wind_SFC:_Fcst -1']
|
||||||
Png_image = 'T'
|
Png_image = 'T'
|
||||||
|
|
|
@ -43,7 +43,6 @@ VariableList = [("Check or Force:" , "Check Only", "radio",
|
||||||
import SmartScript
|
import SmartScript
|
||||||
import TimeRange
|
import TimeRange
|
||||||
import AbsTime
|
import AbsTime
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
from numpy import *
|
from numpy import *
|
||||||
|
|
||||||
MODEL = "Fcst"
|
MODEL = "Fcst"
|
||||||
|
@ -63,11 +62,11 @@ class Procedure (SmartScript.SmartScript):
|
||||||
# @return: time ranges at which WEName has data.
|
# @return: time ranges at which WEName has data.
|
||||||
# @rtype: Python list of Python TimeRange objects
|
# @rtype: Python list of Python TimeRange objects
|
||||||
def getWEInventory(self, WEName):
|
def getWEInventory(self, WEName):
|
||||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||||
allTimes = javaTR.allTimes()
|
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||||
parm = self.getParm(MODEL, WEName, LEVEL);
|
parm = self.getParm(MODEL, WEName, LEVEL);
|
||||||
inv = parm.getGridInventory(allTimes)
|
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||||
trList = []
|
trList = []
|
||||||
for gd in inv:
|
for gd in inv:
|
||||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||||
|
|
|
@ -49,7 +49,6 @@ import SmartScript
|
||||||
import time
|
import time
|
||||||
import TimeRange
|
import TimeRange
|
||||||
import AbsTime
|
import AbsTime
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
from numpy import *
|
from numpy import *
|
||||||
|
|
||||||
MODEL = "Fcst"
|
MODEL = "Fcst"
|
||||||
|
@ -61,11 +60,11 @@ class Procedure (SmartScript.SmartScript):
|
||||||
|
|
||||||
|
|
||||||
def getWEInventory(self, WEName):
|
def getWEInventory(self, WEName):
|
||||||
#yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||||
#later = time.time() + 10 * 24 * 3600 # 10 days from now
|
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||||
allTimes = javaTR.allTimes()
|
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||||
parm = self.getParm(MODEL, WEName, LEVEL);
|
parm = self.getParm(MODEL, WEName, LEVEL);
|
||||||
inv = parm.getGridInventory(allTimes)
|
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||||
|
|
||||||
trList = []
|
trList = []
|
||||||
for gd in inv:
|
for gd in inv:
|
||||||
|
@ -81,12 +80,12 @@ class Procedure (SmartScript.SmartScript):
|
||||||
return []
|
return []
|
||||||
lt = parm.getLockTable()
|
lt = parm.getLockTable()
|
||||||
jlok = lt.lockedByOther()
|
jlok = lt.lockedByOther()
|
||||||
lbo = []
|
lbo = []
|
||||||
for i in xrange(jlok.size()):
|
for i in xrange(jlok.size()):
|
||||||
tr = jlok.get(i)
|
tr = jlok.get(i)
|
||||||
tr = TimeRange.TimeRange(tr)
|
tr = TimeRange.TimeRange(tr)
|
||||||
lbo.append( tr )
|
lbo.append( tr )
|
||||||
return lbo
|
return lbo
|
||||||
|
|
||||||
def overlappingTRs(self, timeRange, trList):
|
def overlappingTRs(self, timeRange, trList):
|
||||||
newTRList = []
|
newTRList = []
|
||||||
|
@ -116,7 +115,7 @@ class Procedure (SmartScript.SmartScript):
|
||||||
endWindChill = 4 ## Last month to report wind chill
|
endWindChill = 4 ## Last month to report wind chill
|
||||||
|
|
||||||
# Get local edit area simply by using the baseline edit area
|
# Get local edit area simply by using the baseline edit area
|
||||||
eaList = self.editAreaList()
|
eaList = self.editAreaList()
|
||||||
siteID = self.getSiteID()
|
siteID = self.getSiteID()
|
||||||
|
|
||||||
if siteID in eaList: # make sure the edit area is there
|
if siteID in eaList: # make sure the edit area is there
|
||||||
|
|
|
@ -42,8 +42,6 @@ import time
|
||||||
import AbsTime
|
import AbsTime
|
||||||
import TimeRange
|
import TimeRange
|
||||||
|
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
|
|
||||||
MODEL = "Fcst"
|
MODEL = "Fcst"
|
||||||
LEVEL = "SFC"
|
LEVEL = "SFC"
|
||||||
|
|
||||||
|
@ -148,17 +146,16 @@ class Procedure (SmartScript.SmartScript):
|
||||||
# @return: time ranges at which WEName has data.
|
# @return: time ranges at which WEName has data.
|
||||||
# @rtype: Python list of Python TimeRange objects
|
# @rtype: Python list of Python TimeRange objects
|
||||||
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
||||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
# set up a timeRange if it is None
|
||||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
|
||||||
if timeRange is None:
|
if timeRange is None:
|
||||||
timeRange = javaTR.allTimes()
|
timeRange = TimeRange.allTimes()
|
||||||
parm = self.getParm(dbName, WEName, LEVEL)
|
parm = self.getParm(dbName, WEName, LEVEL)
|
||||||
if parm is None:
|
if parm is None:
|
||||||
print "PFC: dbName =", dbName
|
print "PFC: dbName =", dbName
|
||||||
print "PFC: WEName =", WEName
|
print "PFC: WEName =", WEName
|
||||||
print "PFC: parm is None"
|
print "PFC: parm is None"
|
||||||
return []
|
return []
|
||||||
inv = parm.getGridInventory(timeRange)
|
inv = parm.getGridInventory(timeRange.toJavaObj())
|
||||||
if inv is None: self.statusBarMsg("inv is None","S")
|
if inv is None: self.statusBarMsg("inv is None","S")
|
||||||
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
||||||
trList = []
|
trList = []
|
||||||
|
|
|
@ -42,7 +42,6 @@ VariableList = [("ProductID:", "", "alphaNumeric"),
|
||||||
|
|
||||||
import TimeRange
|
import TimeRange
|
||||||
import AbsTime
|
import AbsTime
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
|
|
||||||
import SmartScript
|
import SmartScript
|
||||||
|
|
||||||
|
@ -608,15 +607,6 @@ class Procedure (SmartScript.SmartScript):
|
||||||
|
|
||||||
return textList
|
return textList
|
||||||
|
|
||||||
# Retrieves a text product from the text database
|
|
||||||
def getTextProductFromDB(self, productID):
|
|
||||||
from com.raytheon.viz.gfe.product import TextDBUtil
|
|
||||||
|
|
||||||
opMode = self.gfeOperatingMode()=="OPERATIONAL"
|
|
||||||
fullText = TextDBUtil.retrieveProduct(productID, opMode)
|
|
||||||
textList = fullText.splitlines(True)
|
|
||||||
return textList
|
|
||||||
|
|
||||||
# Reads decodes depression information using the specified product.
|
# Reads decodes depression information using the specified product.
|
||||||
def decodeDepressionInfo(self, textProduct):
|
def decodeDepressionInfo(self, textProduct):
|
||||||
|
|
||||||
|
@ -650,11 +640,11 @@ class Procedure (SmartScript.SmartScript):
|
||||||
return fcstList
|
return fcstList
|
||||||
|
|
||||||
def getWEInventory(self, modelName, WEName, level):
|
def getWEInventory(self, modelName, WEName, level):
|
||||||
#yesterday = time.time() - (300 * 24 * 3600) # 300 days ago
|
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||||
#later = time.time() + 100 * 24 * 3600 # 100days from now
|
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||||
allTimes = javaTR.allTimes()
|
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||||
parm = self.getParm(modelName, WEName, level);
|
parm = self.getParm(modelName, WEName, level);
|
||||||
inv = parm.getGridInventory(allTimes)
|
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||||
trList = []
|
trList = []
|
||||||
for gd in inv:
|
for gd in inv:
|
||||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||||
|
|
|
@ -42,11 +42,9 @@ import SmartScript
|
||||||
import time
|
import time
|
||||||
import ProcessVariableList
|
import ProcessVariableList
|
||||||
|
|
||||||
from com.raytheon.viz.gfe.core import DataManager
|
|
||||||
|
|
||||||
class Procedure (SmartScript.SmartScript):
|
class Procedure (SmartScript.SmartScript):
|
||||||
def __init__(self, dbss):
|
def __init__(self, dbss):
|
||||||
self._dbss = DataManager.getCurrentInstance()
|
self._dbss = dbss
|
||||||
SmartScript.SmartScript.__init__(self, self._dbss)
|
SmartScript.SmartScript.__init__(self, self._dbss)
|
||||||
|
|
||||||
def execute(self, editArea, timeRange, varDict):
|
def execute(self, editArea, timeRange, varDict):
|
||||||
|
|
|
@ -44,14 +44,6 @@ import UFStatusHandler
|
||||||
import JUtil
|
import JUtil
|
||||||
from java.io import File
|
from java.io import File
|
||||||
from java.lang import System
|
from java.lang import System
|
||||||
from com.raytheon.uf.common.serialization import SerializationUtil
|
|
||||||
from com.raytheon.uf.common.localization import LocalizationFile
|
|
||||||
from com.raytheon.uf.common.localization import PathManagerFactory
|
|
||||||
from com.raytheon.uf.common.localization import LocalizationContext
|
|
||||||
from com.raytheon.uf.common.localization import LocalizationContext_LocalizationType as LocalizationType
|
|
||||||
from com.raytheon.uf.common.localization import LocalizationContext_LocalizationLevel as LocalizationLevel
|
|
||||||
from com.raytheon.uf.common.site.xml import CwaXML
|
|
||||||
from com.raytheon.uf.common.site.xml import AdjacentWfoXML
|
|
||||||
|
|
||||||
PLUGIN_NAME = 'com.raytheon.viz.gfe'
|
PLUGIN_NAME = 'com.raytheon.viz.gfe'
|
||||||
CATEGORY = 'GFE'
|
CATEGORY = 'GFE'
|
||||||
|
|
|
@ -42,9 +42,6 @@ import time
|
||||||
import AbsTime
|
import AbsTime
|
||||||
import TimeRange
|
import TimeRange
|
||||||
|
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
from com.raytheon.uf.common.time import SimulatedTime as simulatedTime
|
|
||||||
|
|
||||||
MODEL = "Fcst"
|
MODEL = "Fcst"
|
||||||
LEVEL = "SFC"
|
LEVEL = "SFC"
|
||||||
|
|
||||||
|
@ -64,14 +61,13 @@ class Procedure (SmartScript.SmartScript):
|
||||||
# @return: time ranges at which WEName has data.
|
# @return: time ranges at which WEName has data.
|
||||||
# @rtype: Python list of Python TimeRange objects
|
# @rtype: Python list of Python TimeRange objects
|
||||||
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
||||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
# set up a timeRange if it is None
|
||||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
|
||||||
if timeRange is None:
|
if timeRange is None:
|
||||||
timeRange = javaTR.allTimes()
|
timeRange = TimeRange.allTimes()
|
||||||
parm = self.getParm(dbName, WEName, LEVEL)
|
parm = self.getParm(dbName, WEName, LEVEL)
|
||||||
if parm is None:
|
if parm is None:
|
||||||
return []
|
return []
|
||||||
inv = parm.getGridInventory(timeRange)
|
inv = parm.getGridInventory(timeRange.toJavaObj())
|
||||||
if inv is None: self.statusBarMsg("inv is None","S")
|
if inv is None: self.statusBarMsg("inv is None","S")
|
||||||
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
||||||
trList = []
|
trList = []
|
||||||
|
@ -226,7 +222,7 @@ class Procedure (SmartScript.SmartScript):
|
||||||
|
|
||||||
# Figure out what year it is
|
# Figure out what year it is
|
||||||
|
|
||||||
currentTime = AbsTime.AbsTime(simulatedTime.getSystemTime().getTime()).unixTime()
|
currentTime = self._gmtime().unixTime()
|
||||||
jan01Tuple = (time.gmtime(currentTime)[0],1,1,0,0,0,0,0,0) # 01 Jan this year
|
jan01Tuple = (time.gmtime(currentTime)[0],1,1,0,0,0,0,0,0) # 01 Jan this year
|
||||||
jan01Secs = time.mktime(jan01Tuple) # 01 Jan in seconds
|
jan01Secs = time.mktime(jan01Tuple) # 01 Jan in seconds
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ VariableList = [("Product to\ndecode:", [], "check",
|
||||||
|
|
||||||
import TimeRange
|
import TimeRange
|
||||||
import AbsTime
|
import AbsTime
|
||||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
|
||||||
|
|
||||||
import SmartScript
|
import SmartScript
|
||||||
|
|
||||||
|
@ -615,15 +614,6 @@ class Procedure (SmartScript.SmartScript):
|
||||||
f.close()
|
f.close()
|
||||||
return textList
|
return textList
|
||||||
|
|
||||||
# Retrieves a text product from the text database
|
|
||||||
def getTextProductFromDB(self, productID):
|
|
||||||
from com.raytheon.viz.gfe.product import TextDBUtil
|
|
||||||
|
|
||||||
opMode = self.gfeOperatingMode()=="OPERATIONAL"
|
|
||||||
fullText = TextDBUtil.retrieveProduct(productID, opMode)
|
|
||||||
textList = fullText.splitlines(True)
|
|
||||||
return textList
|
|
||||||
|
|
||||||
def printFcst(self, f, baseTime):
|
def printFcst(self, f, baseTime):
|
||||||
print "=============================================================="
|
print "=============================================================="
|
||||||
print "Time:", time.asctime(time.gmtime(f['validTime'])),
|
print "Time:", time.asctime(time.gmtime(f['validTime'])),
|
||||||
|
@ -639,11 +629,11 @@ class Procedure (SmartScript.SmartScript):
|
||||||
print r, "kts:", f['radii'][r]
|
print r, "kts:", f['radii'][r]
|
||||||
|
|
||||||
def getWEInventory(self, modelName, WEName, level):
|
def getWEInventory(self, modelName, WEName, level):
|
||||||
#yesterday = time.time() - (300 * 24 * 3600) # 300 days ago
|
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||||
#later = time.time() + 100 * 24 * 3600 # 100days from now
|
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||||
allTimes = javaTR.allTimes()
|
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||||
parm = self.getParm(modelName, WEName, level);
|
parm = self.getParm(modelName, WEName, level);
|
||||||
inv = parm.getGridInventory(allTimes)
|
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||||
trList = []
|
trList = []
|
||||||
for gd in inv:
|
for gd in inv:
|
||||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||||
|
|
|
@ -48,9 +48,6 @@ from numpy import *
|
||||||
import ProcessVariableList
|
import ProcessVariableList
|
||||||
import SmartScript
|
import SmartScript
|
||||||
|
|
||||||
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GFERecord_GridType as GridType
|
|
||||||
|
|
||||||
|
|
||||||
toolName = 'LimitValues'
|
toolName = 'LimitValues'
|
||||||
|
|
||||||
class Tool (SmartScript.SmartScript):
|
class Tool (SmartScript.SmartScript):
|
||||||
|
@ -59,7 +56,6 @@ class Tool (SmartScript.SmartScript):
|
||||||
|
|
||||||
def preProcessGrid(self,editArea,variableElement,
|
def preProcessGrid(self,editArea,variableElement,
|
||||||
variableElement_GridInfo,WEname):
|
variableElement_GridInfo,WEname):
|
||||||
wxType = variableElement_GridInfo.getGridType()
|
|
||||||
#
|
#
|
||||||
# Need a mask of the current edit area, so the
|
# Need a mask of the current edit area, so the
|
||||||
# dialog can figure out the current max/min in
|
# dialog can figure out the current max/min in
|
||||||
|
@ -81,10 +77,10 @@ class Tool (SmartScript.SmartScript):
|
||||||
# setup valgrid with the grid that will be
|
# setup valgrid with the grid that will be
|
||||||
# limited (i.e. for vectors the speed)
|
# limited (i.e. for vectors the speed)
|
||||||
#
|
#
|
||||||
if wxType.equals(GridType.SCALAR):
|
if type(variableElement) is list:
|
||||||
valgrid=variableElement
|
|
||||||
if wxType.equals(GridType.VECTOR):
|
|
||||||
(valgrid,dir)=variableElement
|
(valgrid,dir)=variableElement
|
||||||
|
else:
|
||||||
|
valgrid=variableElement
|
||||||
#
|
#
|
||||||
# When checking for mins, need all areas outside the edit
|
# When checking for mins, need all areas outside the edit
|
||||||
# area set to the max value for this element - so that the
|
# area set to the max value for this element - so that the
|
||||||
|
@ -148,18 +144,17 @@ class Tool (SmartScript.SmartScript):
|
||||||
# Main routine that reads in the variableElement and limits it to
|
# Main routine that reads in the variableElement and limits it to
|
||||||
# the values set up via the dialog in the preProcessGrid routine
|
# the values set up via the dialog in the preProcessGrid routine
|
||||||
#
|
#
|
||||||
def execute(self, variableElement, variableElement_GridInfo, varDict):
|
def execute(self, variableElement, varDict):
|
||||||
"limit gridvalues between user-set limits"
|
"limit gridvalues between user-set limits"
|
||||||
#
|
#
|
||||||
# set val to the grid we will limit
|
# set val to the grid we will limit
|
||||||
# (if it is a vector - get the speed)
|
# (if it is a vector - get the speed)
|
||||||
#
|
#
|
||||||
wxType = variableElement_GridInfo.getGridType()
|
if type(variableElement) is list:
|
||||||
if wxType.equals(GridType.SCALAR):
|
|
||||||
val=variableElement
|
|
||||||
if wxType.equals(GridType.VECTOR):
|
|
||||||
val=variableElement[0]
|
val=variableElement[0]
|
||||||
dir=variableElement[1]
|
dir=variableElement[1]
|
||||||
|
else:
|
||||||
|
val=variableElement
|
||||||
#
|
#
|
||||||
# limit the values, max first, then min
|
# limit the values, max first, then min
|
||||||
#
|
#
|
||||||
|
@ -170,9 +165,9 @@ class Tool (SmartScript.SmartScript):
|
||||||
# put the trimmed values back
|
# put the trimmed values back
|
||||||
#
|
#
|
||||||
|
|
||||||
if wxType.equals(GridType.SCALAR):
|
if type(variableElement) is list:
|
||||||
variableElement=valC
|
|
||||||
if wxType.equals(GridType.VECTOR):
|
|
||||||
variableElement=(valC,dir)
|
variableElement=(valC,dir)
|
||||||
|
else:
|
||||||
|
variableElement=valC
|
||||||
|
|
||||||
return variableElement
|
return variableElement
|
||||||
|
|
|
@ -2380,4 +2380,13 @@ class SmartScript(BaseTool.BaseTool):
|
||||||
import JUtil
|
import JUtil
|
||||||
return JUtil.javaStringListToPylist(self.__dataMgr.knownOfficeTypes())
|
return JUtil.javaStringListToPylist(self.__dataMgr.knownOfficeTypes())
|
||||||
|
|
||||||
|
# Retrieves a text product from the text database
|
||||||
|
def getTextProductFromDB(self, productID):
|
||||||
|
from com.raytheon.viz.gfe.product import TextDBUtil
|
||||||
|
|
||||||
|
opMode = self.gfeOperatingMode()=="OPERATIONAL"
|
||||||
|
fullText = TextDBUtil.retrieveProduct(productID, opMode)
|
||||||
|
textList = fullText.splitlines(True)
|
||||||
|
return textList
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue