本文整理汇总了Python中LogStream.logVerbose方法的典型用法代码示例。如果您正苦于以下问题:Python LogStream.logVerbose方法的具体用法?Python LogStream.logVerbose怎么用?Python LogStream.logVerbose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogStream
的用法示例。
在下文中一共展示了LogStream.logVerbose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _dtgFromDDHHMM
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def _dtgFromDDHHMM(self, dtgString):
#utility function taking a ddhhmm string
#group1=day, group2=hour, group3=minute
#returns a time object
wmo_day = int(dtgString[0:2])
wmo_hour = int(dtgString[2:4])
wmo_min = int(dtgString[4:6])
gmtuple = time.gmtime(self._time)
wmo_year = gmtuple[0] #based on current time
wmo_month = gmtuple[1] #based on current time
current_day = gmtuple[2]
if current_day - wmo_day > 15:
# next month
wmo_month = wmo_month + 1
if wmo_month > 12:
wmo_month = 1
wmo_year = wmo_year + 1
elif current_day - wmo_day < -15:
# previous month
wmo_month = wmo_month -1
if wmo_month < 1:
wmo_month = 12
wmo_year = wmo_year - 1
s = `wmo_year` + "%02i" % wmo_month + "%02i" % wmo_day + \
"%02i" % wmo_hour + "%02i" % wmo_min + "UTC"
timeTuple = time.strptime(s, "%Y%m%d%H%M%Z")
wmoTime = time.mktime(timeTuple) #TZ is GMT0, so this mktime works
LogStream.logVerbose("DTG=",dtgString, "IssueTime=",
time.asctime(time.gmtime(wmoTime)))
return wmoTime
示例2: decode
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def decode(self):
#get pil and date-time group
self._productPil, self._issueTime, linePos,\
self._completeProductPil = self._getPilAndDTG()
# If this is a WCL - don't go any further. Run WCL procedure and exit.
if self._productPil[0:3] == "WCL":
endpoint = "WCLWatch"
# build a Java object for the warning
from com.raytheon.edex.plugin.gfe.wcl import WclInfo
import JUtil
lines = JUtil.pyValToJavaObj(self._lines)
warning = WclInfo(long(self._issueTime * 1000),
self._completeProductPil, lines, self._notifyGFE)
from com.raytheon.uf.edex.core import EDEXUtil
EDEXUtil.getMessageProducer().sendAsync(endpoint, warning)
LogStream.logEvent("%s forwarded to WCLWatch" % self._productPil)
return []
# Determine if this is a segmented product
segmented = self._determineSegmented(linePos)
# Get overview text
if segmented == 1:
self._overviewText, linePos = self._getOverviewText(linePos)
else:
self._overviewText = ''
LogStream.logDebug("OverviewText: ", self._overviewText)
#find all UGCs, VTEC strings, and segment text
ugcVTECList = self._getUGCAndVTECStrings(linePos)
self._polygon = self._getPolygon(linePos)
self._storm = self._getStorm(linePos)
#convert UGC strings into UGC list
ugcVTECSegText = []
segCount = 1
for ugcString, vtecStrings, segText, cities in ugcVTECList:
purgeTime = None
self._checkForDTG(ugcString)
if self._hasDTG:
purgeTime = self._dtgFromDDHHMM(ugcString[-7:-1])
else:
purgeTime = self._getPurgeTimeFromVTEC(vtecStrings)
vtecList = self._expandVTEC(ugcString, vtecStrings, segCount,
segText, cities, purgeTime)
segCount = segCount + 1
for r in vtecList:
ugcVTECSegText.append(r)
if len(ugcVTECSegText) == 0:
LogStream.logVerbose("No VTEC Found in product")
return
return ugcVTECSegText
示例3: __init__
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def __init__(self, procName, host, port, userName,
configFile, startTime, endTime, timeRange, editArea,
mutableModel, varDict):
# import the config file
prefs = loadConfig.loadPreferences(configFile)
LogStream.logEvent("Configuration File: ", configFile)
if mutableModel is None:
mutableModel = prefs.getString('mutableModel')
else:
prefs.setValue('mutableModel', mutableModel)
self.__dataMgr = DataManager.getInstance(None)
# Create Time Range
if startTime is not None and endTime is not None:
start = self.getAbsTime(startTime)
end = self.getAbsTime(endTime)
self.__timeRange = TimeRange.TimeRange(start, end)
elif timeRange is not None:
self.__timeRange = TimeRange.TimeRange(self.__dataMgr.getSelectTimeRangeManager().getRange(timeRange).toTimeRange());
else:
self.__timeRange = TimeRange.default()
if editArea is not None:
refID = ReferenceID(editArea)
self.__editArea = \
self.__dataMgr.getRefManager().loadRefSet(refID)
else:
self.__editArea = self.__dataMgr.getRefManager().emptyRefSet()
LogStream.logVerbose("varDict=",varDict)
runner = ProcedureRunner(procName)
errors = runner.getImportErrors()
if len(errors) > 0:
print "Error importing the following procedures:\n"
for s in errors:
print s
sys.exit(1)
runner.instantiate(procName, CLASS_NAME, **{'dbss':self.__dataMgr})
runner.run(self.__dataMgr, procName, CLASS_NAME, METHOD_NAME, varDict, self.__editArea, self.__timeRange)
示例4: _decodeCommandLine
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def _decodeCommandLine(self):
#Routine to decode the command line.
if self._command is None:
self.command = sys.argv
if len(self._command) < 2:
self._usage()
sys.exit(1)
LogStream.logVerbose("Command line: ", self._command[1:])
try:
optionlist, arglist = getopt.getopt(self._command[1:], 'f:da:gw:nz:')
except getopt.error, val:
LogStream.logProblem(val)
self._usage()
sys.exit(1)
示例5: saveOldActiveTable
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def saveOldActiveTable(self, oldActiveTable):
#saves off the specified table and time stamps it
if self._activeTableFilename is None:
raise Exception, "saveOldActiveTable without filename"
#determine filename
directory = os.path.join(os.path.dirname(self._activeTableFilename), "backup")
try:
os.makedirs(directory)
except OSError as e:
if e.errno != errno.EEXIST:
LogStream.logProblem("Could not create active table backup directory:",
directory, LogStream.exc())
raise e
gmtime = time.gmtime(time.time())
format = "%Y%m%d_%H%M%S"
baseN = os.path.basename(self._activeTableFilename)
fn = time.strftime(format, gmtime) + "_" + baseN
filename = os.path.join(directory, fn + ".gz")
t = time.time()
try:
os.chmod(filename, 0666)
os.remove(filename)
except:
pass
#output file
#gzip it to save space
with gzip.GzipFile(filename, 'wb', 9) as fd:
buf = cPickle.dumps(oldActiveTable)
fd.write(buf)
os.chmod(filename, 0664)
t1 = time.time()
tstr = "%.3f" % (t1-t)
LogStream.logVerbose("Saved Previous Active Table: ", fn, "t=",
tstr, "sec.")
示例6: _getPilAndDTG
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def _getPilAndDTG(self):
#searches through the product (lines) and extracts out the product
#pil and date-time group. Returns (pil, issueTime, lineEnd, fullpil).
# The line end is how far the processing got for the PIL line.
count = 0
while 1:
dtg_search = re.search(r' ([0123][0-9][012][0-9][0-5][0-9])',
self._lines[count])
pil_search = re.search(r'^([A-Z]{3})(\w{3}|\w{2}|\w{1})',
self._lines[count+1])
if dtg_search and pil_search:
LogStream.logVerbose("Dtg=", dtg_search.group(0))
LogStream.logVerbose("Pil=", pil_search.group(0))
return (self._lines[count+1][0:3],
self._dtgFromDDHHMM(dtg_search.group(1)), count+2,
pil_search.group(0))
count = count + 1
if count >= len(self._lines)-1:
LogStream.logProblem("Did not find either the product DTG" +\
" or the pil: ", string.join(self._lines, sep='\n'),
LogStream.exc())
raise Exception, "Product DTG or Pil missing"
示例7: createComboFiles
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def createComboFiles(definitionDir, outputDir, mapDict):
#list of definition files
LogStream.logEvent("definitionDir", definitionDir)
files = glob.glob(definitionDir + '/*Definition.py')
for f in files:
LogStream.logEvent("File", f)
# read the file
fd = open(f, 'r')
buf = fd.read()
fd.close()
LogStream.logVerbose("Definition File:", f)
# attempt to read in the Definition dictionary
try:
exec buf
except:
LogStream.logProblem("Failure on Definition: ", f)
continue
if Definition.has_key("mapNameForCombinations") and \
Definition.has_key("defaultEditAreas") and \
type(Definition['defaultEditAreas']) is str:
srcDict = {} #keep track of what zones from what map
#determine if a single map or multiple maps
if type(Definition["mapNameForCombinations"]) is str:
maps = [Definition["mapNameForCombinations"]]
else:
maps = []
for m in Definition["mapNameForCombinations"]:
maps.append(m)
LogStream.logVerbose("mapNameForCombinations=", maps)
outName = Definition["defaultEditAreas"]
LogStream.logVerbose("Generating Combo File: ", outName)
#See if the definition limits the zones to subdomains
if Definition.has_key("subDomainUGCs") and \
Definition["subDomainUGCs"] is not None:
limitZones = Definition["subDomainUGCs"]
else:
limitZones = None
#pull out the EDITAREA attribute from all of the maps
eans = []
for m in maps:
names = mapDict.get(m)
if names is not None:
size = names.size()
LogStream.logVerbose("processing: ", m, "#recs=",
size)
for n in range(size):
ean = str(names.get(n))
if limitZones is None or ean in limitZones:
#tracking source map
if len(ean):
slist = srcDict.get(m, [])
if ean not in slist:
slist.append(ean)
srcDict[m] = slist
#combo file
if ean not in eans and len(ean):
eans.append(ean)
eans.sort()
LogStream.logVerbose("eans=", eans)
s = """
# ----------------------------------------------------------------------------
# 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.
#
# Combinations
# <comboName>
#
# Author: GFESuite Installation Script
# ----------------------------------------------------------------------------
# Format:
# Combinations = [
# ([ list of edit areas as named in the GFE ], label),
# ...
# ]
Combinations = [
"""
s = string.replace(s, "<comboName>",
Definition['defaultEditAreas'])
count = 1
for ean in eans:
s = s + ' (["' + ean + '"], "Region' + `count` + \
'"),\n'
#.........这里部分代码省略.........
示例8: updateActiveTable
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
def updateActiveTable(self, activeTable, newRecords, offsetSecs=0):
#merges the previous active table and new records into a new table.
#Returns:
# (updated active table, purged records, changesforNotify, changeFlag)
updatedTable = []
changes = []
changedFlag = False
#delete "obsolete" records from the old table.
vts = VTECTableSqueeze.VTECTableSqueeze(self._time+offsetSecs)
activeTable, tossRecords = vts.squeeze(activeTable)
for r in tossRecords:
r['state'] = "Purged"
del vts
if len(tossRecords):
changedFlag = True
#expand out any 000 UGC codes, such as FLC000, to indicate all
#zones.
newRecExpanded = []
compare1 = ['phen', 'sig', 'officeid', 'etn', 'pil']
for newR in newRecords:
if newR['id'][3:6] == "000":
for oldR in activeTable:
if self.hazardCompare(oldR, newR, compare1) and \
oldR['id'][0:2] == newR['id'][0:2] and \
(oldR['act'] not in ['EXP', 'CAN', 'UPG'] or \
oldR['act'] == 'EXP' and oldR['endTime'] > newR['issueTime']):
newE = copy.deepcopy(newR)
newE['id'] = oldR['id']
newRecExpanded.append(newE)
else:
newRecExpanded.append(newR)
newRecords = newRecExpanded
# match new records with old records, with issue time is different
# years and event times overlap. Want to reassign ongoing events
# from last year's issueTime to be 12/31/2359z, rather than the
# real issuetime (which is this year's).
compare = ['phen', 'sig', 'officeid', 'pil', 'etn']
for newR in newRecords:
cyear = time.gmtime(newR['issueTime'])[0] #current year issuance time
lastYearIssueTime = time.mktime((cyear-1, 12, 31, 23, 59,
0, -1, -1, -1))
for oldR in activeTable:
if self.hazardCompare(oldR, newR, compare):
oldYear = time.gmtime(oldR['issueTime'])[0]
newYear = time.gmtime(newR['issueTime'])[0]
if oldYear < newYear:
if (newR['act'] == "EXP" and newR['endTime'] == oldR['endTime']) or \
self.__overlaps((oldR['startTime'],oldR['endTime']), (newR['startTime'],newR['endTime'])):
LogStream.logVerbose("Reset issuance time to last year:",
"\nNewRec: ", self.printEntry(newR),
"OldRec: ", self.printEntry(oldR))
newR['issueTime'] = lastYearIssueTime
# split records out by issuance year for processing
newRecDict = {} #key is issuance year
oldRecDict = {}
years = []
for newR in newRecords:
issueYear = time.gmtime(newR['issueTime'])[0]
records = newRecDict.get(issueYear, [])
records.append(newR)
newRecDict[issueYear] = records
if issueYear not in years:
years.append(issueYear)
for oldR in activeTable:
issueYear = time.gmtime(oldR['issueTime'])[0]
records = oldRecDict.get(issueYear, [])
records.append(oldR)
oldRecDict[issueYear] = records
if issueYear not in years:
years.append(issueYear)
# process each year
compare = ['id', 'phen', 'sig', 'officeid', 'pil']
for year in years:
newRecords = newRecDict.get(year,[])
oldRecords = oldRecDict.get(year,[])
# now process the old and new records
for oldR in oldRecords:
keepflag = 1
for newR in newRecords:
if newR['act'] == "ROU":
continue
if self.hazardCompare(oldR, newR, compare):
#we don't keep older records with same etns
if newR['etn'] == oldR['etn']:
keepflag = 0 #don't bother keeping this record
break
#higher etns
elif newR['etn'] > oldR['etn']:
#.........这里部分代码省略.........
示例9: _getUGCAndVTECStrings
# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logVerbose [as 别名]
#.........这里部分代码省略.........
count+nxt,
'[' + self._lines[count+nxt-1] + ']')
nxt = nxt - 1
ugc = string.join(self._lines[count:count+nxt+1],sep="")
break
if len(ugc) == 0:
s = "Did not find end of UGC line which started on " +\
" line " + `count`
LogStream.logProblem(s)
raise Exception, "Aborting due to bad UGC lines"
#find the VTEC codes following the ugc line(s)
nxt = nxt + 1 #go the 1st line after ugc
vtectext = []
while count+nxt < len(self._lines):
if re.search(self._vtecRE, self._lines[count+nxt]):
hvtec = None
if re.search(self._hVtecRE, self._lines[count+nxt+1]):
hvtec = self._lines[count+nxt+1]
vtectext.append((self._lines[count+nxt], hvtec))
LogStream.logDebug("VTEC found on line: ",
count+nxt, self._lines[count+nxt])
elif (re.search(self._badVtecRE, self._lines[count+nxt]) \
and not re.search(self._hVtecRE, self._lines[count+nxt])):
LogStream.logProblem("Bad VTEC line detected on line#",
count+nxt, '[' + self._lines[count+nxt] + ']',
'UGC=', ugc)
raise Exception,"Aborting due to bad VTEC line"
else:
break #no more VTEC lines for this ugc
nxt = nxt + 1 #go to next line
# for capturing the city names
cityFirst = count+nxt
cityLast = cityFirst - 1
#capture the text from dtg to the $$ at the beginning of
#the line. Just in case there isn't a $$, we also look
#for a new VTEC or UGC line, or the end of file.
textFirst = count+nxt
dtgFound = 0
segmentText = ""
while count+nxt < len(self._lines):
# Date-TimeGroup
if dtgFound == 0 and re.search(self._dlineRE,
self._lines[count+nxt]):
cityLast = count+nxt-1
textFirst = count+nxt+2 #first text line
dtgFound = 1
# found the $$ line
elif re.search(self._endSegmentRE, self._lines[count+nxt]):
segmentText = self._prepSegmentText(\
self._lines[textFirst:count+nxt])
break
# found a UGC line, terminate the segment
elif re.search(r'^[A-Z][A-Z][CZ][0-9][0-9][0-9].*',
self._lines[count+nxt]):
segmentText = self._prepSegmentText(\
self._lines[textFirst:count+nxt])
nxt = nxt - 1 #back up one line to redo UGC outer loop
break
# end of file, terminate the segment
elif count+nxt+1 == len(self._lines):
segmentText = self._prepSegmentText(\
self._lines[textFirst:count+nxt+1])
break
nxt = nxt + 1 #next line
# capture cities
cityText = ''
for i in range(cityFirst, cityLast+1):
line = self._lines[i].rstrip()
if line.startswith("INCLUDING THE"):
cityText = line
elif cityText != '':
cityText += line
cities = []
if cityText != '':
cities = cityText.split('...')[1:]
#add the ugc and vtec text to the list
ugcList.append((ugc, vtectext, segmentText, cities))
count = count + nxt
count = count + 1
if count >= len(self._lines):
break
for e in ugcList:
LogStream.logVerbose("UGC/VTEC found: ", e[0], e[1])
return ugcList