def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """Constructor Args: text (string): the raw PTS product that is to be parsed utcnow (datetime, optional): in case of ambuigity with time ugc_provider (dict, optional): unused in this class nwsli_provider (dict, optional): unused in this class """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) LOG.info("==== SPCPTS Processing: %s", self.get_product_id()) load_conus_data(self.valid) self.issue = None self.expire = None self.day = None self.outlook_type = None self.outlook_collections = dict() self.set_metadata() self.find_issue_expire() self.find_outlooks() self.quality_control()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # Hold our parsing results as an array of dicts self.data = [] self.regime = None # Sometimes, we get products that are not really in CLI format but # are RER (record event reports) with a CLI AWIPS ID if self.wmo[:2] != 'CD': print(('Product %s skipped due to wrong header') % (self.get_product_id(), )) return for section in self.find_sections(): if len(HEADLINE_RE.findall(section.replace("\n", " "))) == 0: continue # We have meat! self.compute_diction(section) valid, station = self.parse_cli_headline(section) data = self.parse_data(section) self.data.append( dict(cli_valid=valid, cli_station=station, data=data))
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """constructor""" TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.data = [] self.parse_data()
def __init__(self, text, utcnow=None): """Constructor Args: text (str): text to parse """ TextProduct.__init__(self, text, utcnow=utcnow) self.data = _processor(self)
def __init__(self, text): ''' constructor ''' TextProduct.__init__(self, text) self.geometry = self.parse_geometry() self.discussion_num = self.parse_discussion_num() self.attn_wfo = self.parse_attn_wfo() self.attn_rfc = self.parse_attn_rfc() self.areas_affected = self.parse_areas_affected() self.watch_prob = self.find_watch_probability() self.cwsus = []
def __init__(self, text, utcnow=None): """Constructor Args: text (str): text to parse """ TextProduct.__init__(self, text, utcnow=utcnow) self.data = None self.issue = None self.do_parsing()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """Constructor Args: text (string): the raw string to process""" TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.metars = [] self.split_and_parse()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # Hold our parsing results as an array of dicts self.station = "%s%s" % (self.source[0], self.afos[3:]) self.df = None self.parser()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' TextProduct.__init__(self, text, utcnow=utcnow, ugc_provider=ugc_provider, nwsli_provider=nwsli_provider)
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.sigmets = [] if self.afos in ['SIGC', 'SIGW', 'SIGE', 'SIGAK1', 'SIGAK2']: self.process_SIGC() elif self.afos[:2] == 'WS': self.process_WS() else: self.process_ocean()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' # Make sure we are CRLF above all else if text.find("\r\r\n") == -1: text = text.replace("\n", "\r\r\n") # Get rid of extraneous whitespace on right hand side only text = "\r\r\n".join([a.rstrip() for a in text.split("\r\r\n")]) TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.nwsli_provider = nwsli_provider self.skip_con = self.get_skip_con()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.geometry = self.parse_geometry() self.discussion_num = self.parse_discussion_num() self.attn_wfo = self.parse_attn_wfo() self.attn_rfc = self.parse_attn_rfc() self.areas_affected = self.parse_areas_affected() self.watch_prob = self.find_watch_probability() self.sts, self.ets = self.find_valid_times() self.cwsus = []
def __init__(self, text, utcnow=None): """Constructor Args: text (str): text to parse """ TextProduct.__init__(self, text, utcnow=utcnow) self.saw = int(self.afos[3:].strip()) self.action = self.find_action() self.geometry = self.find_polygon() self.ww_num = self.find_ww_num() (self.sts, self.ets) = self.find_time() self.ww_type = self.find_ww_type()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.geometry = self.parse_geometry() self.discussion_num = self.parse_discussion_num() self.attn_wfo = self.parse_attn_wfo() self.attn_rfc = self.parse_attn_rfc() self.areas_affected = self.parse_areas_affected() self.watch_prob = self.find_watch_probability() self.cwsus = []
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.sigmets = [] if self.afos in ["SIGC", "SIGW", "SIGE", "SIGAK1", "SIGAK2"]: self.process_SIGC() elif self.afos[:2] == "WS": self.process_WS() else: self.process_ocean()
def __init__(self, text, utcnow=None): """Constructor Args: text (str): text to parse """ TextProduct.__init__(self, text, utcnow=utcnow) self.saw = int(self.afos[3:].strip()) self.action = self.find_action() self.geometry = self.find_polygon() self.ww_num = self.find_ww_num() (self.sts, self.ets) = self.find_time() self.ww_type = self.find_ww_type() self.affected_wfos = []
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): ''' constructor ''' # Make sure we are CRLF above all else if text.find("\r\r\n") == -1: text = text.replace("\n", "\r\r\n") # Get rid of extraneous whitespace on right hand side only text = "\r\r\n".join([a.rstrip() for a in text.split("\r\r\n")]) TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # Which time partitioned table does this product belong to # defaults to current UTC valid self.db_year = self.valid.year self.nwsli_provider = nwsli_provider self.skip_con = self.get_skip_con()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ self.lsrs = [] self.duplicates = 0 TextProduct.__init__( self, text, utcnow=utcnow, ugc_provider=ugc_provider, nwsli_provider=nwsli_provider, )
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) self.geometry = self.parse_geometry() self.discussion_num = self.parse_discussion_num() self.attn_wfo = self.parse_attn_wfo() self.attn_rfc = self.parse_attn_rfc() self.areas_affected = self.parse_areas_affected() self.concerning = self.parse_concerning() self.watch_prob = self.find_watch_probability() self.sts, self.ets = self.find_valid_times() self.cwsus = []
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ # Make sure we are CRLF above all else if text.find("\r\r\n") == -1: text = text.replace("\n", "\r\r\n") # Get rid of extraneous whitespace on right hand side only text = "\r\r\n".join([a.rstrip() for a in text.split("\r\r\n")]) TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # Which time partitioned table does this product belong to # defaults to current UTC valid self.db_year = self.valid.year self.skip_con = self.get_skip_con() # If there was no/bad MND header, a backwards way to know is that the # product time zone will be None, add a warning if self.z is None: self.warnings.append("Could not find local timezone in text.")
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """Constructor Args: text (string): the raw PTS product that is to be parsed utcnow (datetime, optional): in case of ambuigity with time ugc_provider (dict, optional): unused in this class nwsli_provider (dict, optional): unused in this class """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) print("==== SPCPTS Processing: %s" % (self.get_product_id(), )) load_conus_data(self.valid) self.issue = None self.expire = None self.day = None self.outlook_type = None self.outlook_collections = dict() self.set_metadata() self.find_issue_expire() self.find_outlooks() self.quality_control()
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # hold our parsing results self.data = [] lines = self.unixtext.split("\n") if len(lines[3]) < 10: meat = ("".join(lines[4:])).split("=") else: meat = ("".join(lines[3:])).split("=") for piece in meat: if piece == "": continue res = process(piece) if res is None: self.warnings.append("DSM RE Match Failure: '%s'" % (piece, )) continue res.compute_times(utcnow) self.data.append(res)
def __init__(self, text, utcnow=None, ugc_provider=None, nwsli_provider=None): """ constructor """ TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider) # Hold our parsing results as an array of dicts self.data = [] self.regime = None # Sometimes, we get products that are not really in CLI format but # are RER (record event reports) with a CLI AWIPS ID if self.wmo[:2] != 'CD': print(('Product %s skipped due to wrong header' ) % (self.get_product_id(),)) return for section in self.find_sections(): if not HEADLINE_RE.findall(section.replace("\n", " ")): continue # We have meat! self.compute_diction(section) valid, station = self.parse_cli_headline(section) data = self.parse_data(section) self.data.append(dict(cli_valid=valid, cli_station=station, data=data))
def __init__(self, text, utcnow=None): ''' constructor ''' self.lsrs = [] self.duplicates = 0 TextProduct.__init__(self, text, utcnow=utcnow)