######################################################################## # Hazard_MWS_Local.py # # ########################################################################## import Hazard_MWS import string, time, re, os, types, copy, AFPS class TextProduct(Hazard_MWS.TextProduct): Definition = copy.deepcopy(Hazard_MWS.TextProduct.Definition) Definition['displayName'] = None Definition['displayName'] = "Hazard_MWS (Marine Weather Statement)" #Definition["easPhrase"] = "" # Optional EAS phrase to be include in product header #Definition["hazardSamplingThreshold"] = (10, None) #(%cov, #points) def __init__(self): Hazard_MWS.TextProduct.__init__(self) def _postProcessProduct(self, fcst, argDict): # # Clean up multiple line feeds # fixMultiLF = re.compile(r'(\n\n)\n*', re.DOTALL) fcst = fixMultiLF.sub(r'\1', fcst) ############################################################################################ # The next 3 lines of code replace ellipses with framing code to unlock existing headlines # ############################################################################################ pat = re.compile(r'^\.\.\..+?\.\.\.$', re.MULTILINE|re.DOTALL) for headLine in pat.findall(fcst): fcst = fcst.replace(headLine, '|* %s *|' % headLine) ########################################################################################## # # Set to Upper Case # fcst = string.upper(fcst) # # Finish Progress Meter # self.setProgressPercentage(100) self.progressMessage(0, 100, self._displayName + " Complete") return fcst