Issue #851 Cleaned up unnecessary Java imports in baselined tools/procedures.
Change-Id: I49ad2815c2b524a63c115c1b2424b41831247d97 Former-commit-id:d68ece4d55
[formerlyd3e0cd5af8
] [formerlyd68ece4d55
[formerlyd3e0cd5af8
] [formerlye71059c2b9
[formerly ff032c53a059f25558aabdc5b483c4cc59ad3f6e]]] Former-commit-id:e71059c2b9
Former-commit-id:60de5ca0f4
[formerly473e6e9eb2
] Former-commit-id:34452f236e
This commit is contained in:
parent
4b106a3f0f
commit
971c1d8731
11 changed files with 53 additions and 86 deletions
|
@ -22,6 +22,8 @@
|
|||
from gfeConfig import *
|
||||
import gfeConfig
|
||||
|
||||
HideConfigFile = 1
|
||||
|
||||
# Defines the T as the displayable weather element
|
||||
Png_parms = ['T_SFC:_Fcst -1', 'Td_SFC:_Fcst -1', 'Wind_SFC:_Fcst -1']
|
||||
Png_image = 'T'
|
||||
|
|
|
@ -43,7 +43,6 @@ VariableList = [("Check or Force:" , "Check Only", "radio",
|
|||
import SmartScript
|
||||
import TimeRange
|
||||
import AbsTime
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
from numpy import *
|
||||
|
||||
MODEL = "Fcst"
|
||||
|
@ -63,11 +62,11 @@ class Procedure (SmartScript.SmartScript):
|
|||
# @return: time ranges at which WEName has data.
|
||||
# @rtype: Python list of Python TimeRange objects
|
||||
def getWEInventory(self, WEName):
|
||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = javaTR.allTimes()
|
||||
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||
parm = self.getParm(MODEL, WEName, LEVEL);
|
||||
inv = parm.getGridInventory(allTimes)
|
||||
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||
trList = []
|
||||
for gd in inv:
|
||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||
|
|
|
@ -49,7 +49,6 @@ import SmartScript
|
|||
import time
|
||||
import TimeRange
|
||||
import AbsTime
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
from numpy import *
|
||||
|
||||
MODEL = "Fcst"
|
||||
|
@ -61,11 +60,11 @@ class Procedure (SmartScript.SmartScript):
|
|||
|
||||
|
||||
def getWEInventory(self, WEName):
|
||||
#yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
||||
#later = time.time() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = javaTR.allTimes()
|
||||
parm = self.getParm(MODEL, WEName, LEVEL);
|
||||
inv = parm.getGridInventory(allTimes)
|
||||
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||
parm = self.getParm(MODEL, WEName, LEVEL);
|
||||
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||
|
||||
trList = []
|
||||
for gd in inv:
|
||||
|
@ -81,12 +80,12 @@ class Procedure (SmartScript.SmartScript):
|
|||
return []
|
||||
lt = parm.getLockTable()
|
||||
jlok = lt.lockedByOther()
|
||||
lbo = []
|
||||
for i in xrange(jlok.size()):
|
||||
tr = jlok.get(i)
|
||||
tr = TimeRange.TimeRange(tr)
|
||||
lbo.append( tr )
|
||||
return lbo
|
||||
lbo = []
|
||||
for i in xrange(jlok.size()):
|
||||
tr = jlok.get(i)
|
||||
tr = TimeRange.TimeRange(tr)
|
||||
lbo.append( tr )
|
||||
return lbo
|
||||
|
||||
def overlappingTRs(self, timeRange, trList):
|
||||
newTRList = []
|
||||
|
@ -116,7 +115,7 @@ class Procedure (SmartScript.SmartScript):
|
|||
endWindChill = 4 ## Last month to report wind chill
|
||||
|
||||
# Get local edit area simply by using the baseline edit area
|
||||
eaList = self.editAreaList()
|
||||
eaList = self.editAreaList()
|
||||
siteID = self.getSiteID()
|
||||
|
||||
if siteID in eaList: # make sure the edit area is there
|
||||
|
|
|
@ -42,8 +42,6 @@ import time
|
|||
import AbsTime
|
||||
import TimeRange
|
||||
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
|
||||
MODEL = "Fcst"
|
||||
LEVEL = "SFC"
|
||||
|
||||
|
@ -148,17 +146,16 @@ class Procedure (SmartScript.SmartScript):
|
|||
# @return: time ranges at which WEName has data.
|
||||
# @rtype: Python list of Python TimeRange objects
|
||||
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
||||
# set up a timeRange if it is None
|
||||
if timeRange is None:
|
||||
timeRange = javaTR.allTimes()
|
||||
timeRange = TimeRange.allTimes()
|
||||
parm = self.getParm(dbName, WEName, LEVEL)
|
||||
if parm is None:
|
||||
print "PFC: dbName =", dbName
|
||||
print "PFC: WEName =", WEName
|
||||
print "PFC: parm is None"
|
||||
return []
|
||||
inv = parm.getGridInventory(timeRange)
|
||||
inv = parm.getGridInventory(timeRange.toJavaObj())
|
||||
if inv is None: self.statusBarMsg("inv is None","S")
|
||||
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
||||
trList = []
|
||||
|
|
|
@ -42,7 +42,6 @@ VariableList = [("ProductID:", "", "alphaNumeric"),
|
|||
|
||||
import TimeRange
|
||||
import AbsTime
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
|
||||
import SmartScript
|
||||
|
||||
|
@ -608,15 +607,6 @@ class Procedure (SmartScript.SmartScript):
|
|||
|
||||
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.
|
||||
def decodeDepressionInfo(self, textProduct):
|
||||
|
||||
|
@ -650,11 +640,11 @@ class Procedure (SmartScript.SmartScript):
|
|||
return fcstList
|
||||
|
||||
def getWEInventory(self, modelName, WEName, level):
|
||||
#yesterday = time.time() - (300 * 24 * 3600) # 300 days ago
|
||||
#later = time.time() + 100 * 24 * 3600 # 100days from now
|
||||
allTimes = javaTR.allTimes()
|
||||
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||
parm = self.getParm(modelName, WEName, level);
|
||||
inv = parm.getGridInventory(allTimes)
|
||||
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||
trList = []
|
||||
for gd in inv:
|
||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||
|
|
|
@ -42,11 +42,9 @@ import SmartScript
|
|||
import time
|
||||
import ProcessVariableList
|
||||
|
||||
from com.raytheon.viz.gfe.core import DataManager
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
self._dbss = DataManager.getCurrentInstance()
|
||||
self._dbss = dbss
|
||||
SmartScript.SmartScript.__init__(self, self._dbss)
|
||||
|
||||
def execute(self, editArea, timeRange, varDict):
|
||||
|
|
|
@ -44,14 +44,6 @@ import UFStatusHandler
|
|||
import JUtil
|
||||
from java.io import File
|
||||
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'
|
||||
CATEGORY = 'GFE'
|
||||
|
|
|
@ -42,9 +42,6 @@ import time
|
|||
import AbsTime
|
||||
import TimeRange
|
||||
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
from com.raytheon.uf.common.time import SimulatedTime as simulatedTime
|
||||
|
||||
MODEL = "Fcst"
|
||||
LEVEL = "SFC"
|
||||
|
||||
|
@ -64,14 +61,13 @@ class Procedure (SmartScript.SmartScript):
|
|||
# @return: time ranges at which WEName has data.
|
||||
# @rtype: Python list of Python TimeRange objects
|
||||
def _getWEInventory(self, dbName, WEName, timeRange=None):
|
||||
# yesterday = time.time() - (2 * 24 * 3600) # two days ago
|
||||
# later = time.time() + 10 * 24 * 3600 # 10 days from now
|
||||
# set up a timeRange if it is None
|
||||
if timeRange is None:
|
||||
timeRange = javaTR.allTimes()
|
||||
timeRange = TimeRange.allTimes()
|
||||
parm = self.getParm(dbName, WEName, LEVEL)
|
||||
if parm is None:
|
||||
return []
|
||||
inv = parm.getGridInventory(timeRange)
|
||||
inv = parm.getGridInventory(timeRange.toJavaObj())
|
||||
if inv is None: self.statusBarMsg("inv is None","S")
|
||||
elif len(inv)==0: print self.statusBarMsg("PFC: len(inv)==0","S")
|
||||
trList = []
|
||||
|
@ -226,7 +222,7 @@ class Procedure (SmartScript.SmartScript):
|
|||
|
||||
# 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
|
||||
jan01Secs = time.mktime(jan01Tuple) # 01 Jan in seconds
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ VariableList = [("Product to\ndecode:", [], "check",
|
|||
|
||||
import TimeRange
|
||||
import AbsTime
|
||||
from com.raytheon.uf.common.time import TimeRange as javaTR
|
||||
|
||||
import SmartScript
|
||||
|
||||
|
@ -615,15 +614,6 @@ class Procedure (SmartScript.SmartScript):
|
|||
f.close()
|
||||
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):
|
||||
print "=============================================================="
|
||||
print "Time:", time.asctime(time.gmtime(f['validTime'])),
|
||||
|
@ -639,11 +629,11 @@ class Procedure (SmartScript.SmartScript):
|
|||
print r, "kts:", f['radii'][r]
|
||||
|
||||
def getWEInventory(self, modelName, WEName, level):
|
||||
#yesterday = time.time() - (300 * 24 * 3600) # 300 days ago
|
||||
#later = time.time() + 100 * 24 * 3600 # 100days from now
|
||||
allTimes = javaTR.allTimes()
|
||||
yesterday = self._gmtime() - (2 * 24 * 3600) # two days ago
|
||||
later = self._gmtime() + 10 * 24 * 3600 # 10 days from now
|
||||
allTimes = TimeRange.TimeRange(yesterday, later)
|
||||
parm = self.getParm(modelName, WEName, level);
|
||||
inv = parm.getGridInventory(allTimes)
|
||||
inv = parm.getGridInventory(allTimes.toJavaObj())
|
||||
trList = []
|
||||
for gd in inv:
|
||||
tr = TimeRange.TimeRange(gd.getGridTime())
|
||||
|
|
|
@ -48,9 +48,6 @@ from numpy import *
|
|||
import ProcessVariableList
|
||||
import SmartScript
|
||||
|
||||
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GFERecord_GridType as GridType
|
||||
|
||||
|
||||
toolName = 'LimitValues'
|
||||
|
||||
class Tool (SmartScript.SmartScript):
|
||||
|
@ -59,7 +56,6 @@ class Tool (SmartScript.SmartScript):
|
|||
|
||||
def preProcessGrid(self,editArea,variableElement,
|
||||
variableElement_GridInfo,WEname):
|
||||
wxType = variableElement_GridInfo.getGridType()
|
||||
#
|
||||
# Need a mask of the current edit area, so the
|
||||
# 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
|
||||
# limited (i.e. for vectors the speed)
|
||||
#
|
||||
if wxType.equals(GridType.SCALAR):
|
||||
valgrid=variableElement
|
||||
if wxType.equals(GridType.VECTOR):
|
||||
if type(variableElement) is list:
|
||||
(valgrid,dir)=variableElement
|
||||
else:
|
||||
valgrid=variableElement
|
||||
#
|
||||
# When checking for mins, need all areas outside the edit
|
||||
# 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
|
||||
# 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"
|
||||
#
|
||||
# set val to the grid we will limit
|
||||
# (if it is a vector - get the speed)
|
||||
#
|
||||
wxType = variableElement_GridInfo.getGridType()
|
||||
if wxType.equals(GridType.SCALAR):
|
||||
val=variableElement
|
||||
if wxType.equals(GridType.VECTOR):
|
||||
if type(variableElement) is list:
|
||||
val=variableElement[0]
|
||||
dir=variableElement[1]
|
||||
else:
|
||||
val=variableElement
|
||||
#
|
||||
# limit the values, max first, then min
|
||||
#
|
||||
|
@ -170,9 +165,9 @@ class Tool (SmartScript.SmartScript):
|
|||
# put the trimmed values back
|
||||
#
|
||||
|
||||
if wxType.equals(GridType.SCALAR):
|
||||
variableElement=valC
|
||||
if wxType.equals(GridType.VECTOR):
|
||||
if type(variableElement) is list:
|
||||
variableElement=(valC,dir)
|
||||
else:
|
||||
variableElement=valC
|
||||
|
||||
return variableElement
|
||||
|
|
|
@ -2380,4 +2380,13 @@ class SmartScript(BaseTool.BaseTool):
|
|||
import JUtil
|
||||
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