Merge branch 'emc_14.4.1' of gerrit:AWIPS2_Dev_Baseline into emc_14.4.1
Former-commit-id: 6c72e1864ad5843c4ac42a558b589777af047c77
This commit is contained in:
commit
171a38175c
1 changed files with 87 additions and 78 deletions
145
cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/Run_NWPS.py
Executable file → Normal file
145
cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/Run_NWPS.py
Executable file → Normal file
|
@ -5,11 +5,14 @@
|
|||
#
|
||||
# Run_NWPS
|
||||
# Description:
|
||||
# This runs a Procedure within the GFE that builds
|
||||
# Swan Fcst Wind grids based on the Operational Wind Fcst grids
|
||||
#
|
||||
# This runs a Procedure within the GFE that builds NWPS
|
||||
# forecast wind grids based on the operational wind forecast grids
|
||||
# and then sends those Wind grids to the NWPS model.
|
||||
#
|
||||
# Authors: Pablo Santos and Alex Gibbs.
|
||||
# Last Modified: 11/12/14 for AWIPS Baseline.
|
||||
#
|
||||
# Last Modified: 01/23/15 by AG/PS for AWIPS Baseline.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# The MenuItems list defines the GFE menu item(s) under which the
|
||||
|
@ -17,62 +20,42 @@
|
|||
# Verify, Hazards
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
import SmartScript, LogStream, time
|
||||
from math import *
|
||||
import SmartScript, LogStream
|
||||
import time, os, shutil, TimeRange, AbsTime
|
||||
|
||||
def fileNameFromIntTime(floatTime):
|
||||
|
||||
tupleTime = time.gmtime(floatTime)
|
||||
#print "TUPLETIME IS: ", tupleTime
|
||||
return time.strftime("%Y%m%d_%H00", tupleTime)
|
||||
|
||||
def getButtonNames():
|
||||
|
||||
currentTime = int(time.time() / 3600) * 3600 # truncated to this hour
|
||||
#currentTime = (self._gmtime().unixTime()/3600)*3600
|
||||
|
||||
if time.gmtime(currentTime).tm_hour % 3 != 0:
|
||||
currentTime = currentTime + (3 * 3600) # add three hours
|
||||
|
||||
startTime = int(currentTime / (3 * 3600)) * (3 * 3600)
|
||||
#print "StartTime from GUI is: ", startTime
|
||||
|
||||
timeStrs = []
|
||||
timeList = []
|
||||
for i in range(0, 7):
|
||||
currentTime = startTime + (3 * i) * 3600 - 64800
|
||||
strTime = fileNameFromIntTime(currentTime)
|
||||
timeList.append(currentTime)
|
||||
timeStrs.append(strTime)
|
||||
|
||||
return timeStrs,timeList
|
||||
|
||||
buttonList, timeList = getButtonNames()
|
||||
|
||||
VariableList = [
|
||||
("How Long Do You Want To Run NWPS:" , 102, "scale", [12, 102], 3),
|
||||
#("NWPS Model Winds:", "ForecastWindGrids", "radio", ["ForecastWindGrids"]),
|
||||
("Model Start Time:", buttonList[6], "radio", buttonList),
|
||||
("Local or NCEP:", "Local", "radio", ["Local","NCEP"]),
|
||||
("Model Core:", "SWAN", "radio", ["SWAN","NWW","UNSWAN"]),
|
||||
("Send Output to Web:", "Yes", "radio", ["Yes","No"]),
|
||||
("Plot Output Only (No Web):", "No", "radio", ["Yes","No"]),
|
||||
("Boundary Conditions:", "WNAWave", "radio", ["WNAWave", "TAFB-NWPS", "HURWave", "No"]),
|
||||
("**Boundary Conditions: OPC/TAFB-NWPS: CHECK www.srh.noaa.gov/rtimages/nhc/wfo_boundary_conditions for up to date files for your SITE**\nNOTE: make sure there is a file time stamp online matching your selected Model Start Time","", "label"),
|
||||
("Run Hi Res NEST:", "Yes", "radio", ["Yes","No"]),
|
||||
("RTOFS Currents:", "Yes", "radio", ["Yes","No"]),
|
||||
("Model Time Step:", "600", "radio", ["1200","900","600","300"]),
|
||||
("Hotstart:", "True", "radio", ["True", "False"]),
|
||||
("Waterlevels:", "ESTOFS", "radio", ["ESTOFS","PSURGE", "No"]),
|
||||
("If PSURGE\n% Exceedance Hgt:", "10", "radio", ["10", "20", "30", "40", "50"]),
|
||||
|
||||
]
|
||||
import ProcessVariableList
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def fileNameFromIntTime(self, floatTime):
|
||||
tupleTime = time.gmtime(floatTime)
|
||||
# print "TUPLETIME IS: ", tupleTime
|
||||
return time.strftime("%Y%m%d_%H00", tupleTime)
|
||||
|
||||
def getButtonNames(self):
|
||||
|
||||
#currentTime = int(time.time() / 3600) * 3600 # truncated to this hour
|
||||
currentTime = (self._gmtime().unixTime()/3600)*3600
|
||||
#print "currentTime: ", currentTime
|
||||
|
||||
if time.gmtime(currentTime).tm_hour % 6 != 0:
|
||||
currentTime = currentTime + (6 * 3600) # add three hours
|
||||
|
||||
startTime = int(currentTime / (6 * 3600)) * (6 * 3600)
|
||||
#print "StartTime from GUI is: ", startTime
|
||||
|
||||
timeStrs = []
|
||||
timeList = []
|
||||
|
||||
for i in range(0, 7):
|
||||
currentTime = startTime + (6 * i) * 3600 - 108000 # 30 hrs
|
||||
strTime = self.fileNameFromIntTime(currentTime)
|
||||
timeList.append(currentTime)
|
||||
timeStrs.append(strTime)
|
||||
|
||||
return timeStrs,timeList
|
||||
|
||||
def getModelTimeRange(self, modelID, param):
|
||||
#before = time.time() - (3000 * 24 * 3600) # 3000 days ago. Does not work with DRT
|
||||
#later = time.time() + 100 * 24 * 3600 # 100 days from now. Does not work with DRT
|
||||
|
@ -99,21 +82,48 @@ class Procedure (SmartScript.SmartScript):
|
|||
return modelTR, minTime, maxTime
|
||||
|
||||
def execute(self, editArea, timeRange, varDict):
|
||||
fcst_length = varDict["How Long Do You Want To Run NWPS:"]
|
||||
#wind = varDict["NWPS Model Winds:"]
|
||||
|
||||
buttonList, timeList = self.getButtonNames()
|
||||
|
||||
variableList = [
|
||||
("How Long Do You Want To Run NWPS:" , 102, "scale", [12, 102], 3),
|
||||
#("NWPS Model Winds:", "ForecastWindGrids", "radio", ["ForecastWindGrids"]),
|
||||
("Model Start Time:", buttonList[4], "radio", buttonList),
|
||||
("Local or NCEP:", "Local", "radio", ["Local","NCEP"]),
|
||||
("Model Core:", "SWAN", "radio", ["SWAN","NWW","UNSWAN"]),
|
||||
("Send Output to Web:", "Yes", "radio", ["Yes","No"]),
|
||||
("Plot Output Only (No Web):", "No", "radio", ["Yes","No"]),
|
||||
("Boundary Conditions:", "WNAWave", "radio", ["WNAWave", "TAFB-NWPS", "HURWave", "No"]),
|
||||
("**Boundary Conditions: OPC/TAFB-NWPS: CHECK www.srh.noaa.gov/rtimages/nhc/wfo_boundary_conditions for up to date files for your SITE**\nNOTE: make sure there is a file time stamp online matching your selected Model Start Time","", "label"),
|
||||
("Run Hi Res NEST:", "Yes", "radio", ["Yes","No"]),
|
||||
("RTOFS Currents:", "Yes", "radio", ["Yes","No"]),
|
||||
("Model Time Step:", "600", "radio", ["1200","900","600","300"]),
|
||||
("Hotstart:", "True", "radio", ["True", "False"]),
|
||||
("Waterlevels:", "ESTOFS", "radio", ["ESTOFS","PSURGE", "No"]),
|
||||
("If PSURGE\n% Exceedance Hgt:", "10", "radio", ["10", "20", "30", "40", "50"]),
|
||||
]
|
||||
|
||||
varDict = {}
|
||||
processVarList = ProcessVariableList.ProcessVariableList("Run_NWPS", variableList, varDict, None)
|
||||
status = processVarList.status()
|
||||
if status != "OK":
|
||||
return
|
||||
|
||||
fcst_length = processVarList.varDict()["How Long Do You Want To Run NWPS:"]
|
||||
wind="ForecastWindGrids"
|
||||
modelstarttime = varDict["Model Start Time:"]
|
||||
wheretorun = varDict["Local or NCEP:"]
|
||||
model = varDict["Model Core:"]
|
||||
web = varDict["Send Output to Web:"]
|
||||
plot = varDict["Plot Output Only (No Web):"]
|
||||
wna = varDict["Boundary Conditions:"]
|
||||
nests = varDict["Run Hi Res NEST:"]
|
||||
stream = varDict["RTOFS Currents:"]
|
||||
tstep = varDict["Model Time Step:"]
|
||||
hotstart = varDict["Hotstart:"]
|
||||
waterlevels = varDict["Waterlevels:"]
|
||||
excd = varDict["If PSURGE\n% Exceedance Hgt:"]
|
||||
modelstarttime = processVarList.varDict()["Model Start Time:"]
|
||||
wheretorun = processVarList.varDict()["Local or NCEP:"]
|
||||
model = processVarList.varDict()["Model Core:"]
|
||||
web = processVarList.varDict()["Send Output to Web:"]
|
||||
plot = processVarList.varDict()["Plot Output Only (No Web):"]
|
||||
wna = processVarList.varDict()["Boundary Conditions:"]
|
||||
nests = processVarList.varDict()["Run Hi Res NEST:"]
|
||||
stream = processVarList.varDict()["RTOFS Currents:"]
|
||||
tstep = processVarList.varDict()["Model Time Step:"]
|
||||
hotstart = processVarList.varDict()["Hotstart:"]
|
||||
waterlevels = processVarList.varDict()["Waterlevels:"]
|
||||
excd = processVarList.varDict()["If PSURGE\n% Exceedance Hgt:"]
|
||||
|
||||
fcstlength = str(fcst_length)
|
||||
wind = str(wind)
|
||||
wna = str(wna)
|
||||
|
@ -157,7 +167,6 @@ class Procedure (SmartScript.SmartScript):
|
|||
self.saveElements(["NWPSwind"])
|
||||
|
||||
inp_args = fcstlength + ":" + wna + ":" + nest + ":" + gstream + ":" + wind + ":" + web + ":" + plot + ":" + tstep + ":" + hotstart + ":" + waterlevels + ":" + model + ":" + excd + ":" + wheretorun
|
||||
#print "inp_args are: ", inp_args
|
||||
|
||||
try:
|
||||
os.stat('/tmp/nwps')
|
||||
|
|
Loading…
Add table
Reference in a new issue