Omaha #4961 Create/update procedures for using GMTED2010 terrain in GFE.
Change-Id: I6b51386be983546d0637d4f85ebdad87abcce3a4 Former-commit-id: 2ff9b807b8586bbb56880fe5f3f26505bbd5d87d
This commit is contained in:
parent
d126af0f85
commit
82e09ad9b4
13 changed files with 393 additions and 196 deletions
|
@ -30,15 +30,16 @@
|
|||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Jan 13, 2015 #3955 randerso Copied from EditTopo GFE config file and updated
|
||||
# 01/13/2015 #3955 randerso Copied from EditTopo GFE config file and updated
|
||||
# 10/13/2015 #4961 randerso Renamed parameters from Terrain to Topo
|
||||
#
|
||||
# Author: romberg
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# This special GFE configuration file is for modifying the topo
|
||||
# This special GFE configuration file is for modifying the NewTopo
|
||||
# grid that is stored on the ifpServer. Starting the GFE
|
||||
# with this configuration file should bring up a special GFE with
|
||||
# just the Topo parameter.
|
||||
# just the Topo parameters
|
||||
|
||||
# Include this line to override gfeConfig (BASE configuration):
|
||||
from gfeConfig import *
|
||||
|
@ -48,7 +49,7 @@ HideConfigFile = 1
|
|||
|
||||
DefaultGroup = "NewTerrain"
|
||||
|
||||
mutableModel = "EditTopo_Topo"
|
||||
mutableModel = "EditTopo_NewTerrain"
|
||||
|
||||
dbTypes = ["EditTopo", ""]
|
||||
|
||||
|
@ -56,8 +57,11 @@ dbTypes = ["EditTopo", ""]
|
|||
# fact that these grids have a 1 second resolution
|
||||
SplitBoundaryDisplay = no
|
||||
|
||||
GMTED_fitToDataColorTable = "All Grids"
|
||||
GTOPO_fitToDataColorTable = "All Grids"
|
||||
NewTopo_fitToDataColorTable = "All Grids"
|
||||
Topo_fitToDataColorTable = "All Grids"
|
||||
NewTerrain_fitToDataColorTable = "All Grids"
|
||||
OldTerrain_fitToDataColorTable = "All Grids"
|
||||
|
||||
GridManagerSortOrder = ['NewTopo', 'Topo', 'GMTED', 'GTOPO']
|
||||
|
||||
GM_TE_Layout = "OnLeft"
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# CopyFromNewTopo.py
|
||||
#
|
||||
# Creates a backup copy of the current GFE Topo in PrevTopo
|
||||
# and then replaces the GFE Topo with the NewTopo
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 10/13/2015 #4961 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, timeRange):
|
||||
mutableID = self.mutableID()
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
if mutableID != topoDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database",
|
||||
"You must be using the EditTopo GFE configuration to run this procedure.\n"
|
||||
"Please restart CAVE and select the EditTopo GFE configuration.")
|
||||
return
|
||||
|
||||
# check for existence of NewTopo grid
|
||||
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
|
||||
newTopoParm = self.getParm(newTerrainDbId, "NewTopo", "SFC")
|
||||
inventory = newTopoParm.getGridInventory()
|
||||
if len(inventory) == 0:
|
||||
DisplayMessage.openError("No NewTopo grid exists!",
|
||||
"You must initialize and edit the NewTopo grid as desired.\n"
|
||||
"You should run this procedure only when your edits are final.")
|
||||
return
|
||||
|
||||
doIt = DisplayMessageDialog.openQuestion("WARNING!",
|
||||
"You are about to replace your GFE Topo data with the NewTopo data.\n"
|
||||
"You should only do this after you have completed all edits and have\n"
|
||||
"resolved any border differences with your neighboring sites.\n\n"
|
||||
"Do you wish to continue?")
|
||||
|
||||
if not doIt:
|
||||
return;
|
||||
|
||||
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
|
||||
prevTopoParm = self.getParm(baseTerrainDbId, "PrevTopo", "SFC")
|
||||
inventory = prevTopoParm.getGridInventory()
|
||||
doIt = True
|
||||
if len(inventory) > 0:
|
||||
doIt = DisplayMessageDialog.openQuestion("WARNING PrevTopo exists!",
|
||||
"It appears that you have previously run CopyFromNewTopo and a\n"
|
||||
"backup copy of your original GFE Topo grid already exists.\n\n"
|
||||
"Do you want to overwrite the backup copy with your current GFE Topo grid?")
|
||||
if doIt:
|
||||
# Save the current Topo grid to PrevTopo
|
||||
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
|
||||
prevTopoParm.setMutable(True)
|
||||
self.createGrid(baseTerrainDbId, "PrevTopo", "SCALAR", topo, TimeRange.allTimes())
|
||||
prevTopoParm.saveParameter(True)
|
||||
prevTopoParm.setMutable(False)
|
||||
|
||||
# Copy the NewTopo data to Topo
|
||||
newTopo = self.getGrids(newTerrainDbId, "NewTopo", "SFC", timeRange, mode="First")
|
||||
|
||||
topoParm = self.getParm(topoDbId, "Topo", "SFC")
|
||||
self.createGrid(topoDbId, "Topo", "SCALAR", newTopo, TimeRange.allTimes())
|
||||
topoParm.saveParameter(True)
|
||||
|
||||
DisplayMessageDialog.openInformation("Topo Successfully Updated!",
|
||||
"To revert to the previous version, run the RevertTopo procedure.")
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# DiffNewTerrain.py
|
||||
#
|
||||
# Creates temporary elements newTerrainDiff and oldTerrainDiff by subtracting the
|
||||
# GFE Topo grid from the NewTerrain and OldTerrain elements respectively.
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Jan 13, 2015 #3955 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
import numpy
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, editArea, timeRange, varDict):
|
||||
mutableID = self.mutableID()
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
if mutableID != topoDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database", "You must be using the NewTerrain GFE configuration to run this procedure.\nPlease restart CAVE and select the NewTerrain GFE configuraion")
|
||||
return
|
||||
|
||||
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
|
||||
|
||||
newTerrain = self.getGrids(newTerrainDbId, "NewTerrain", "SFC", timeRange, mode="First")
|
||||
oldTerrain = self.getGrids(newTerrainDbId, "OldTerrain", "SFC", timeRange, mode="First")
|
||||
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
|
||||
|
||||
self.unloadWEs(newTerrainDbId, [("newTerrainDiff", "SFC"),("oldTerrainDiff", "SFC")])
|
||||
|
||||
delta = topo - newTerrain
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "newTerrainDiff", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"NewTerrain - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
||||
|
||||
delta = topo - oldTerrain
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(1.0, abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "oldTerrainDiff", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"OldTerrain - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
|
@ -0,0 +1,86 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# DiffNewTopo.py
|
||||
#
|
||||
# Creates the following temporary difference elements:
|
||||
# newTopoMinusTopo = NewTopo - Topo
|
||||
# GMTEDminusGTOPO = GMTED - GTOPO
|
||||
# newEdits = NewTopo - GMTED
|
||||
# currentEdits = Topo - GTOPO
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 10/13/2015 #4961 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
import numpy
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, timeRange):
|
||||
mutableID = self.mutableID()
|
||||
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
|
||||
if mutableID != newTerrainDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database",
|
||||
"You must be using the NewTerrain GFE configuration to run this procedure.\n"
|
||||
"Please restart CAVE and select the NewTerrain GFE configuration.")
|
||||
return
|
||||
|
||||
newTopo = self.getGrids(newTerrainDbId, "NewTopo", "SFC", timeRange, mode="First")
|
||||
|
||||
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
|
||||
gmted = self.getGrids(baseTerrainDbId, "GMTED", "SFC", timeRange, mode="First")
|
||||
gtopo = self.getGrids(baseTerrainDbId, "GTOPO", "SFC", timeRange, mode="First")
|
||||
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
|
||||
|
||||
self.unloadWEs(newTerrainDbId,
|
||||
[("newTopoMinusTopo", "SFC"),
|
||||
("GMTEDminusGTOPO", "SFC"),
|
||||
("newEdits", "SFC"),
|
||||
("currentEdits", "SFC")])
|
||||
|
||||
delta = newTopo - topo
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(1.0, abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "newTopoMinusTopo", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"NewTopo - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
||||
|
||||
delta = gmted - gtopo
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(1.0, abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "GMTEDminusGTOPO", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"GMTED - GTOPO", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
||||
|
||||
delta = newTopo - gmted
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(1.0, abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "newEdits", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"NewTopo - GMTED", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
||||
|
||||
delta = topo - gtopo
|
||||
maxVal = numpy.nanmax(delta)
|
||||
minVal = numpy.nanmin(delta)
|
||||
maxDelta = max(1.0, abs(maxVal), abs(minVal))
|
||||
self.createGrid(newTerrainDbId, "currentEdits", "SCALAR", delta, TimeRange.allTimes(),
|
||||
"Topo - GTOPO", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
|
|
@ -1,84 +0,0 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# InitializeNewTerrain.py
|
||||
#
|
||||
# Copies current GFE Topo grid to OldTerrain element in NewTerrain database.
|
||||
# Populates NewTerrain element from GMTED2010 topo dataset.
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Jan 13, 2015 #3955 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, editArea, timeRange, varDict):
|
||||
mutableID = self.mutableID()
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
if mutableID != topoDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database", "You must be using the NewTerrain GFE configuration to run this procedure.\nPlease restart CAVE and select the NewTerrain GFE configuraion")
|
||||
return
|
||||
|
||||
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
|
||||
|
||||
newTerrainParm = self.getParm(newTerrainDbId, "NewTerrain", "SFC")
|
||||
inventory = newTerrainParm.getGridInventory()
|
||||
doIt = True
|
||||
if len(inventory) > 0:
|
||||
doIt = DisplayMessageDialog.openQuestion("NewTerrain Grid exists!", "Do you wish to re-initialize the NewTerrain Grid discarding all your edits?")
|
||||
|
||||
if doIt:
|
||||
newTerrainParm.setMutable(True)
|
||||
newTerrainGrid = self.getTerrainGrid()
|
||||
self.createGrid(newTerrainDbId, "NewTerrain", "SCALAR", newTerrainGrid, TimeRange.allTimes())
|
||||
newTerrainParm.saveParameter(True)
|
||||
newTerrainParm.setMutable(False)
|
||||
|
||||
oldTerrainParm = self.getParm(newTerrainDbId, "OldTerrain", "SFC")
|
||||
inventory = oldTerrainParm.getGridInventory()
|
||||
doIt = True
|
||||
if len(inventory) > 0:
|
||||
doIt = DisplayMessageDialog.openQuestion("OldTerrain Grid exists!", "Do you wish to update it?")
|
||||
|
||||
if doIt:
|
||||
oldTerrainParm.setMutable(True)
|
||||
oldTerrainGrid = self.getTopo()
|
||||
self.createGrid(newTerrainDbId, "OldTerrain", "SCALAR", oldTerrainGrid, TimeRange.allTimes())
|
||||
oldTerrainParm.saveParameter(True)
|
||||
oldTerrainParm.setMutable(False)
|
||||
|
||||
self.setActiveElement(topoDbId, "Topo", "SFC", TimeRange.allTimes())
|
||||
|
||||
def getTerrainGrid(self):
|
||||
gloc = self.getGridLoc()
|
||||
|
||||
from com.raytheon.uf.common.geospatial import MapUtil
|
||||
gridGeometry = MapUtil.getGridGeometry(gloc)
|
||||
|
||||
from com.raytheon.uf.common.topo import TopoQuery
|
||||
from java.io import File
|
||||
terrainData = TopoQuery.getInstance(File("/topo/gmted2010.h5"), 0).getHeight(gridGeometry)
|
||||
|
||||
from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DFloat
|
||||
grid = Grid2DFloat.createGrid(gloc.getNx().intValue(), gloc.getNy().intValue(), terrainData).getNDArray()
|
||||
grid /= 0.3048 # convert from meters to feet
|
||||
|
||||
return grid
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# InitializeNewTopo.py
|
||||
#
|
||||
# Copies current GFE Topo grid to CurrentTopo element in NewTerrain database.
|
||||
# Populates NewTopo element from GMTED2010 topo dataset.
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 10/13/2015 #4961 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
import numpy
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self):
|
||||
mutableID = self.mutableID()
|
||||
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
|
||||
if mutableID != newTerrainDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database",
|
||||
"You must be using the NewTerrain GFE configuration to run this procedure.\n"
|
||||
"Please restart CAVE and select the NewTerrain GFE configuration.")
|
||||
return
|
||||
|
||||
allTimes = TimeRange.allTimes()
|
||||
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
|
||||
gtopoParm = self.getParm(baseTerrainDbId, "GTOPO", "SFC")
|
||||
gtopoGrid = self.getTerrainGrid("gtopo30")
|
||||
gtopoParm.setMutable(True)
|
||||
self.createGrid(baseTerrainDbId, "GTOPO", "SCALAR", gtopoGrid, allTimes)
|
||||
gtopoParm.saveParameter(True)
|
||||
gtopoParm.setMutable(False)
|
||||
|
||||
gmtedParm = self.getParm(baseTerrainDbId, "GMTED", "SFC")
|
||||
gmtedGrid = self.getTerrainGrid("gmted2010")
|
||||
gmtedParm.setMutable(True)
|
||||
self.createGrid(baseTerrainDbId, "GMTED", "SCALAR", gmtedGrid, allTimes)
|
||||
gmtedParm.saveParameter(True)
|
||||
gmtedParm.setMutable(False)
|
||||
|
||||
newTopoParm = self.getParm(newTerrainDbId, "NewTopo", "SFC")
|
||||
inventory = newTopoParm.getGridInventory()
|
||||
doIt = True
|
||||
if len(inventory) > 0:
|
||||
doIt = DisplayMessageDialog.openQuestion("NewTopo Grid exists!",
|
||||
"Do you wish to re-initialize the NewTopo Grid discarding any edits?")
|
||||
|
||||
if doIt:
|
||||
self.createGrid(newTerrainDbId, "NewTopo", "SCALAR", gmtedGrid, allTimes)
|
||||
newTopoParm.saveParameter(True)
|
||||
|
||||
self.setActiveElement(newTerrainDbId, "NewTopo", "SFC", allTimes)
|
||||
|
||||
def getTerrainGrid(self, topoFile):
|
||||
gloc = self.getGridLoc()
|
||||
|
||||
from com.raytheon.uf.common.geospatial import MapUtil
|
||||
gridGeometry = MapUtil.getGridGeometry(gloc)
|
||||
|
||||
from com.raytheon.uf.common.topo import TopoQuery
|
||||
from java.io import File
|
||||
fileName = "/topo/" + topoFile + ".h5"
|
||||
terrainData = TopoQuery.getInstance(File(fileName), 0).getHeight(gridGeometry)
|
||||
grid = numpy.array(terrainData).reshape(self.getGridShape())
|
||||
grid /= 0.3048 # convert from meters to feet
|
||||
|
||||
return grid
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# RevertTopo.py
|
||||
#
|
||||
# Restores the GFE Topo from the most recent backup in PrevTopo
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 10/13/2015 #4961 randerso Initial creation
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
MenuItems = ["Edit"]
|
||||
|
||||
VariableList = []
|
||||
|
||||
import SmartScript
|
||||
import TimeRange
|
||||
import numpy
|
||||
|
||||
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, timeRange):
|
||||
mutableID = self.mutableID()
|
||||
topoDbId = self.findDatabase("EditTopo_Topo")
|
||||
if mutableID != topoDbId:
|
||||
DisplayMessageDialog.openError("Invalid Mutable Database",
|
||||
"You must be using the EditTopo GFE configuration to run this procedure.\n"
|
||||
"Please restart CAVE and select the EditTopo GFE configuration.")
|
||||
return
|
||||
|
||||
# check for existence of PrevTopo grid
|
||||
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
|
||||
prevTopoParm = self.getParm(baseTerrainDbId, "PrevTopo", "SFC")
|
||||
inventory = prevTopoParm.getGridInventory()
|
||||
if len(inventory) == 0:
|
||||
DisplayMessageDialog.openError("No PrevTopo grid exists!",
|
||||
"It appears you have not yet run CopyFromNewTopo so you have\n"
|
||||
"no backup copy to restore.")
|
||||
|
||||
doIt = DisplayMessageDialog.openQuestion("RevertTopo",
|
||||
"You are about to revert your GFE Topo data to the last saved state.\n\n"
|
||||
"Do you wish to continue?")
|
||||
|
||||
if not doIt:
|
||||
return
|
||||
|
||||
# Replace the current Topo grid with PrevTopo
|
||||
prevTopo = self.getGrids(baseTerrainDbId, "PrevTopo", "SFC", timeRange, mode="First")
|
||||
topoParm = self.getParm(topoDbId, "Topo", "SFC")
|
||||
self.createGrid(topoDbId, "Topo", "SCALAR", prevTopo, TimeRange.allTimes())
|
||||
topoParm.saveParameter(True)
|
||||
|
||||
DisplayMessageDialog.openInformation("Success!", "Topo successfully restored!")
|
|
@ -106,8 +106,7 @@ class ProcedureInterface(RollbackMasterInterface.RollbackMasterInterface):
|
|||
except Exceptions.EditActionError, e:
|
||||
if "Cancel" == e.errorType() and "Cancel" == e.errorInfo():
|
||||
return None
|
||||
msg = moduleName + ":" + e.errorType() + ": " + e.errorInfo()
|
||||
raise RuntimeError(msg)
|
||||
raise
|
||||
|
||||
def getMenuName(self, name):
|
||||
return getattr(sys.modules[name], "MenuItems", [])
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
|
||||
<WEGroup name="EditTopo">
|
||||
<WEItem parmID="NewTopo_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
|
||||
<WEItem parmID="Topo_SFC:SITE_GRID_EditTopo_Topo_00000000_0000" relativeCycleNumber="-1"/>
|
||||
<WEItem parmID="OldTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
|
||||
<WEItem parmID="NewTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
|
||||
<WEItem parmID="GMTED_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
|
||||
<WEItem parmID="GTOPO_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
|
||||
</WEGroup>
|
|
@ -21,7 +21,10 @@
|
|||
package com.raytheon.edex.plugin.gfe.isc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.raytheon.edex.plugin.gfe.config.GridDbConfig;
|
||||
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
|
||||
|
@ -42,6 +45,7 @@ import com.raytheon.uf.common.time.TimeRange;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 08/21/09 1995 bphillip Initial port
|
||||
* 06/13/13 2044 randerso Refactored to use IFPServer
|
||||
* 10/13/2015 4961 randerso Add support for ISC from NewTerrain database
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -67,19 +71,17 @@ public class ServiceISCRequest {
|
|||
IFPServerConfig config = ifpServer.getConfig();
|
||||
|
||||
// find the forecast database
|
||||
List<String> parmsAvailable = new ArrayList<String>();
|
||||
Map<DatabaseID, List<String>> parmsAvailable = new HashMap<>();
|
||||
List<DatabaseID> dbs = ifpServer.getGridParmMgr().getDbInventory()
|
||||
.getPayload();
|
||||
DatabaseID db = null;
|
||||
|
||||
for (int i = 0; i < dbs.size(); i++) {
|
||||
if (dbs.get(i).getModelName().equals("Fcst")
|
||||
&& dbs.get(i).getDbType().isEmpty()
|
||||
&& dbs.get(i).getSiteId().equals(siteID)) {
|
||||
GridDbConfig gdc = config.gridDbConfig(dbs.get(i));
|
||||
parmsAvailable = gdc.parmAndLevelList();
|
||||
db = dbs.get(i);
|
||||
break;
|
||||
for (DatabaseID db : dbs) {
|
||||
if (((db.getModelName().equals("Fcst") && db.getDbType().isEmpty()) || (db
|
||||
.getModelName().equals("NewTerrain") && db.getDbType()
|
||||
.equals("EditTopo")))
|
||||
&& db.getSiteId().equals(siteID)) {
|
||||
GridDbConfig gdc = config.gridDbConfig(db);
|
||||
parmsAvailable.put(db, gdc.parmAndLevelList());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,21 +95,26 @@ public class ServiceISCRequest {
|
|||
}
|
||||
|
||||
// verify that we have the data in our database configuration
|
||||
boolean found = parmsAvailable.contains(parmAndLevel);
|
||||
if (!found) {
|
||||
continue;
|
||||
DatabaseID db = null;
|
||||
for (Entry<DatabaseID, List<String>> entry : parmsAvailable
|
||||
.entrySet()) {
|
||||
if (entry.getValue().contains(parmAndLevel)) {
|
||||
db = entry.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
String parmName = parmAndLevel;
|
||||
String level = "SFC";
|
||||
// separate out the parm name and level
|
||||
if (parmAndLevel.contains("_")) {
|
||||
parmName = parmAndLevel.substring(0, parmAndLevel.indexOf("_"));
|
||||
level = parmAndLevel.substring(parmAndLevel.indexOf("_") + 1);
|
||||
}
|
||||
// if db found, add parm to request
|
||||
if (db != null) {
|
||||
// separate out the parm name and level
|
||||
String parmName = parmAndLevel.substring(0,
|
||||
parmAndLevel.indexOf("_"));
|
||||
String level = parmAndLevel
|
||||
.substring(parmAndLevel.indexOf("_") + 1);
|
||||
|
||||
ParmID pid = new ParmID(parmName, db, level);
|
||||
requests.add(pid);
|
||||
ParmID pid = new ParmID(parmName, db, level);
|
||||
requests.add(pid);
|
||||
}
|
||||
}
|
||||
|
||||
List<IscSendRecord> sendReqs = new ArrayList<IscSendRecord>(
|
||||
|
|
|
@ -58,6 +58,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* 04/03/2014 #2737 randerso Changed to send ISC even when no grids are saved
|
||||
* (i.e. on grid deletes)
|
||||
* 01/13/2015 #3955 randerso Enabled sending ISC grids for Topo
|
||||
* 10/13/2015 #4961 randerso Change modelName for NewTopo ISC.
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -106,7 +107,7 @@ public class SaveGfeGridHandler extends BaseGfeRequestHandler implements
|
|||
// ensure Fcst database or Topo database
|
||||
if ((dbid.getModelName().equals("Fcst") && dbid.getDbType()
|
||||
.isEmpty())
|
||||
|| (dbid.getModelName().equals("Topo") && dbid
|
||||
|| (dbid.getModelName().equals("NewTerrain") && dbid
|
||||
.getDbType().equals("EditTopo"))) {
|
||||
IscSendRecord sendReq = new IscSendRecord(
|
||||
save.getParmId(),
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
# 05/29/2015 #17144 bhunder Added weather Params for URMA25 and OCONUS RTMA
|
||||
# 09/02/2015 #4819 rferrel Added HWRF.
|
||||
# 10/07/2015 #4958 dgilling Added support for NationalBlend D2D data.
|
||||
# 10/13/2015 #4961 randerso Updated NewTerrain/BaseTerrain database definitions
|
||||
####################################################################################################
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
@ -2251,18 +2252,24 @@ for wes, tc in (OFFICIALDBS + localParms):
|
|||
#
|
||||
# Add new parameters for NewTerrain
|
||||
#
|
||||
OldTerrain = ("OldTerrain", SCALAR, "ft", "Old Terrain", 50000.0, -32000.0, 1, NO)
|
||||
NewTerrain = ("NewTerrain", SCALAR, "ft", "New Terrain", 50000.0, -32000.0, 1, NO)
|
||||
Topo = ("Topo", SCALAR, "ft", "Topography", 50000.0, -32000.0, 1, NO)
|
||||
NewTopo = ("NewTopo", SCALAR, "ft", "New Topo", 50000.0, -32000.0, 1, NO)
|
||||
PrevTopo = ("PrevTopo", SCALAR, "ft", "Previous Topo", 50000.0, -32000.0, 1, NO)
|
||||
GMTED = ("GMTED", SCALAR, "ft", "GMTED2010", 50000.0, -32000.0, 1, NO)
|
||||
GTOPO = ("GTOPO", SCALAR, "ft", "GTOPO30", 50000.0, -32000.0, 1, NO)
|
||||
Topo = ("Topo", SCALAR, "ft", "Topography", 50000.0, -32000.0, 1, NO)
|
||||
|
||||
NewTerrainDB = ("NewTerrain", GRID, 'EditTopo', YES, NO, 1, 0)
|
||||
NewTerrainParms = [([OldTerrain, NewTerrain], TC1)]
|
||||
NewTerrainDB = ("NewTerrain", GRID, 'EditTopo', YES, NO, 1, 0)
|
||||
NewTerrainParms = [([NewTopo], Persistent)]
|
||||
DATABASES.append((NewTerrainDB, NewTerrainParms))
|
||||
|
||||
BaseTerrainDB = ("BaseTerrain", GRID, 'EditTopo', YES, NO, 1, 0)
|
||||
BaseTerrainParms = [([PrevTopo, GMTED, GTOPO], Persistent)]
|
||||
DATABASES.append((BaseTerrainDB, BaseTerrainParms))
|
||||
|
||||
# Add Topo to ISC parms for NewTerrain
|
||||
if type(REQUESTED_ISC_PARMS) is list and not "Topo" in REQUESTED_ISC_PARMS:
|
||||
REQUESTED_ISC_PARMS.append("Topo")
|
||||
ISCPARMS.append(([Topo], Persistent))
|
||||
if type(REQUESTED_ISC_PARMS) is list and not "NewTopo" in REQUESTED_ISC_PARMS:
|
||||
REQUESTED_ISC_PARMS.append("NewTopo")
|
||||
ISCPARMS.append(([NewTopo], Persistent))
|
||||
|
||||
|
||||
# Now add the ISC and Restore databases to the DATABASES groupings
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
# NumPy 1.9.
|
||||
# 10/05/2015 4951 randerso Fixed siteInDbGrid to retrieve history from the cache so it
|
||||
# sees changes that have not yet been written to the database
|
||||
# 10/05/2015 4961 randerso Fix __calcBlankingTimes to handle persistent grids
|
||||
#
|
||||
##
|
||||
|
||||
|
@ -1436,18 +1437,21 @@ class IscMosaic:
|
|||
|
||||
def __calcBlankingTimes(self, inTimes):
|
||||
out = []
|
||||
for t in range(len(inTimes)):
|
||||
if t == 0 and inTimes[t][0] != 0:
|
||||
out.append((0, inTimes[t][0]))
|
||||
elif t != 0 :
|
||||
tr = (inTimes[t - 1][1], inTimes[t][0])
|
||||
if tr[0] != tr[1]:
|
||||
out.append(tr)
|
||||
if len(out) == 0:
|
||||
if len(inTimes) == 0:
|
||||
out.append((0, 2 ** 30 - 1 + 2 ** 30))
|
||||
else:
|
||||
for t in range(len(inTimes)):
|
||||
if t == 0 and inTimes[t][0] != 0:
|
||||
out.append((0, inTimes[t][0]))
|
||||
elif t != 0 :
|
||||
tr = (inTimes[t - 1][1], inTimes[t][0])
|
||||
if tr[0] != tr[1]:
|
||||
out.append(tr)
|
||||
|
||||
endIndex = len(inTimes) - 1
|
||||
out.append((inTimes[endIndex][1], 2 ** 30 - 1 + 2 ** 30))
|
||||
tr = (inTimes[endIndex][1], 2 ** 30 - 1 + 2 ** 30)
|
||||
if tr[0] != tr[1]:
|
||||
out.append(tr)
|
||||
|
||||
# now limit to the modProcTime
|
||||
outLimit = []
|
||||
|
|
Loading…
Add table
Reference in a new issue