Change-Id: Iacf701775c343077102647136272c92d08776caa Former-commit-id: c7b2c66316ccca08b56fe9ece8f8a24ec260207b
This commit is contained in:
parent
2a96302bfb
commit
8be0082cc2
4 changed files with 39 additions and 23 deletions
|
@ -244,9 +244,8 @@ TCV_AreaDictionary = {
|
||||||
context = pathManager.getContext(loctype, loclevel)
|
context = pathManager.getContext(loctype, loclevel)
|
||||||
context.setContextName(locname)
|
context.setContextName(locname)
|
||||||
localizationFile = pathManager.getLocalizationFile(context, filename)
|
localizationFile = pathManager.getLocalizationFile(context, filename)
|
||||||
pythonFile = File(localizationFile.getFile(), filename, 'r')
|
with File(localizationFile.getFile(), filename, 'r') as pythonFile:
|
||||||
fileContents = pythonFile.read()
|
fileContents = pythonFile.read()
|
||||||
pythonFile.close()
|
|
||||||
|
|
||||||
return fileContents
|
return fileContents
|
||||||
|
|
||||||
|
|
|
@ -657,9 +657,8 @@ FORECASTER STEWART"""
|
||||||
pathManager = PathManagerFactory.getPathManager()
|
pathManager = PathManagerFactory.getPathManager()
|
||||||
context = pathManager.getContextForSite(loctype, siteID)
|
context = pathManager.getContextForSite(loctype, siteID)
|
||||||
localizationFile = pathManager.getLocalizationFile(context, filename)
|
localizationFile = pathManager.getLocalizationFile(context, filename)
|
||||||
pythonFile = File(localizationFile.getFile(), filename, 'r')
|
with File(localizationFile.getFile(), filename, 'r') as pythonFile:
|
||||||
fileContents = pythonFile.read()
|
fileContents = pythonFile.read()
|
||||||
pythonFile.close()
|
|
||||||
|
|
||||||
return fileContents
|
return fileContents
|
||||||
|
|
||||||
|
@ -667,9 +666,9 @@ FORECASTER STEWART"""
|
||||||
pathManager = PathManagerFactory.getPathManager()
|
pathManager = PathManagerFactory.getPathManager()
|
||||||
context = pathManager.getContextForSite(loctype, siteID)
|
context = pathManager.getContextForSite(loctype, siteID)
|
||||||
localizationFile = pathManager.getLocalizationFile(context, filename)
|
localizationFile = pathManager.getLocalizationFile(context, filename)
|
||||||
pythonFile = File(localizationFile.getFile(), filename, 'w')
|
with File(localizationFile.getFile(), filename, 'w') as pythonFile:
|
||||||
pythonFile.write(contents)
|
pythonFile.write(contents)
|
||||||
pythonFile.close()
|
|
||||||
localizationFile.save()
|
localizationFile.save()
|
||||||
|
|
||||||
def _getAdvisoryFilename(self, advisoryName):
|
def _getAdvisoryFilename(self, advisoryName):
|
||||||
|
@ -1975,4 +1974,3 @@ class TextProductCommon(DiscretePhrases.DiscretePhrases):
|
||||||
return ugcStr
|
return ugcStr
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ import string, time, os, re, types, copy, LogStream, collections
|
||||||
import ModuleAccessor, SampleAnalysis, EditAreaUtils
|
import ModuleAccessor, SampleAnalysis, EditAreaUtils
|
||||||
import math
|
import math
|
||||||
import Tkinter
|
import Tkinter
|
||||||
DEG_TO_RAD = 0.017453292
|
import numpy
|
||||||
|
|
||||||
|
|
||||||
from AbsTime import *
|
from AbsTime import *
|
||||||
from StartupDialog import IFPDialog as Dialog
|
from StartupDialog import IFPDialog as Dialog
|
||||||
|
@ -1791,6 +1790,12 @@ class TextProduct(Hazard_HLSTCV_Common.TextProduct):
|
||||||
segment_vtecRecords_tuples = []
|
segment_vtecRecords_tuples = []
|
||||||
for segment in segments:
|
for segment in segments:
|
||||||
vtecRecords = self.getVtecRecords(segment)
|
vtecRecords = self.getVtecRecords(segment)
|
||||||
|
for record in vtecRecords:
|
||||||
|
if record['act'] == "UPG":
|
||||||
|
upgPhenSig = record['phen'] + "." + record['sig']
|
||||||
|
newRecord = self._findNEWAssociatedWithUPG(upgPhenSig, vtecRecords)
|
||||||
|
record['new_record'] = newRecord
|
||||||
|
print "SARAH: vtecRecord =", record
|
||||||
segment_vtecRecords_tuples.append((segment, vtecRecords))
|
segment_vtecRecords_tuples.append((segment, vtecRecords))
|
||||||
|
|
||||||
productSegmentGroup = {
|
productSegmentGroup = {
|
||||||
|
@ -1805,6 +1810,22 @@ class TextProduct(Hazard_HLSTCV_Common.TextProduct):
|
||||||
|
|
||||||
return productSegmentGroup
|
return productSegmentGroup
|
||||||
|
|
||||||
|
def _findNEWAssociatedWithUPG(self, upgPhenSig, vtecRecords):
|
||||||
|
import VTECTable
|
||||||
|
|
||||||
|
possibleUpgrades = []
|
||||||
|
for upgradedTo, upgradedFrom in VTECTable.upgradeHazardsDict:
|
||||||
|
if upgPhenSig in upgradedFrom:
|
||||||
|
possibleUpgrades.append(upgradedTo)
|
||||||
|
|
||||||
|
for record in vtecRecords:
|
||||||
|
if record['act'] == "NEW":
|
||||||
|
newPhenSig = record['phen'] + "." + record['sig']
|
||||||
|
if newPhenSig in possibleUpgrades:
|
||||||
|
return record
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
######################################################
|
######################################################
|
||||||
# Product Dictionary -- General product information
|
# Product Dictionary -- General product information
|
||||||
######################################################
|
######################################################
|
||||||
|
@ -2332,21 +2353,22 @@ class LegacyFormatter():
|
||||||
for hazard in hazardsList:
|
for hazard in hazardsList:
|
||||||
hazardText = ""
|
hazardText = ""
|
||||||
if hazard['act'] == "CON":
|
if hazard['act'] == "CON":
|
||||||
hazardText = "A " + hazard['hdln'] + " remains in effect for:\n"
|
hazardText = "A " + hazard['hdln'] + " remains in effect for " + self._areaWords(hazard['id'])
|
||||||
elif hazard['act'] in ["NEW", "EXA"]:
|
elif hazard['act'] in ["NEW", "EXA"]:
|
||||||
hazardText = "A " + hazard['hdln'] + " has been issued for:\n"
|
hazardText = "A " + hazard['hdln'] + " has been issued for " + self._areaWords(hazard['id'])
|
||||||
elif hazard['act'] == "UPG":
|
elif hazard['act'] == "UPG":
|
||||||
hazardText = "A " + hazard['hdln'] + " has been upgraded for:\n"
|
if hazard['new_record'] is not None:
|
||||||
|
hazardText = "A " + hazard['hdln'] + \
|
||||||
|
" has been upgraded to a " + hazard['new_record']['hdln'] + \
|
||||||
|
" for " + self._areaWords(hazard['id'])
|
||||||
|
else:
|
||||||
|
hazardText = "A " + hazard['hdln'] + " has been upgraded for " + self._areaWords(hazard['id'])
|
||||||
elif hazard['act'] == "CAN":
|
elif hazard['act'] == "CAN":
|
||||||
hazardText = "The " + hazard['hdln'] + " has been cancelled for:\n"
|
hazardText = "The " + hazard['hdln'] + " for " + self._areaWords(hazard['id']) + " has been cancelled"
|
||||||
text += self._textProduct.indentText(hazardText,
|
text += self._textProduct.indentText(hazardText,
|
||||||
indentFirstString = self.TAB + "- ",
|
indentFirstString = self.TAB + "- ",
|
||||||
indentNextString = self.TAB + " ",
|
indentNextString = self.TAB + " ",
|
||||||
maxWidth=self._textProduct._lineLength)
|
maxWidth=self._textProduct._lineLength)
|
||||||
text += self._textProduct.indentText(self._areaWords(hazard['id']) + "\n",
|
|
||||||
indentFirstString = self.TAB + " ",
|
|
||||||
indentNextString = self.TAB + " ",
|
|
||||||
maxWidth=self._textProduct._lineLength)
|
|
||||||
text += "\n"
|
text += "\n"
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
@ -2447,4 +2469,3 @@ class LegacyFormatter():
|
||||||
print "SARAH: subpart newtext =", repr(newtext)
|
print "SARAH: subpart newtext =", repr(newtext)
|
||||||
text += newtext
|
text += newtext
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ import math
|
||||||
from AbsTime import *
|
from AbsTime import *
|
||||||
from StartupDialog import IFPDialog as Dialog
|
from StartupDialog import IFPDialog as Dialog
|
||||||
from LockingFile import File
|
from LockingFile import File
|
||||||
from com.raytheon.uf.common.localization import PathManagerFactory
|
|
||||||
from com.raytheon.uf.common.localization import LocalizationContext_LocalizationType as LocalizationType, LocalizationContext_LocalizationLevel as LocalizationLevel
|
|
||||||
AWIPS_ENVIRON = "AWIPS2"
|
AWIPS_ENVIRON = "AWIPS2"
|
||||||
|
|
||||||
import Hazard_HLSTCV_Common
|
import Hazard_HLSTCV_Common
|
||||||
|
|
Loading…
Add table
Reference in a new issue