Beispiel #1
0
 def __init__(self,
              text,
              utcnow=None,
              ugc_provider=None,
              nwsli_provider=None):
     """ constructor """
     TextProduct.__init__(self, text, utcnow, ugc_provider, nwsli_provider)
Beispiel #2
0
    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()
Beispiel #3
0
 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))
Beispiel #4
0
 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()
Beispiel #5
0
    def __init__(self, text, utcnow=None):
        """Constructor

        Args:
          text (str): text to parse
        """
        TextProduct.__init__(self, text, utcnow=utcnow)
        self.data = _processor(self)
Beispiel #6
0
 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 = []
Beispiel #7
0
    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()
Beispiel #8
0
    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()
Beispiel #9
0
    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()
Beispiel #10
0
    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()
Beispiel #11
0
 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()
Beispiel #12
0
 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)
Beispiel #13
0
 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()
Beispiel #14
0
    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()
Beispiel #15
0
 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 = []
Beispiel #16
0
    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()
Beispiel #17
0
 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()
Beispiel #18
0
 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 = []
Beispiel #19
0
 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()
Beispiel #20
0
    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 = []
Beispiel #21
0
    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()
Beispiel #22
0
 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,
     )
Beispiel #23
0
    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()
Beispiel #24
0
 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 = []
Beispiel #25
0
    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.")
Beispiel #26
0
    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()
Beispiel #27
0
 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)
Beispiel #28
0
 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))
Beispiel #29
0
 def __init__(self, text, utcnow=None):
     ''' constructor '''
     self.lsrs = []
     self.duplicates = 0
     TextProduct.__init__(self, text, utcnow=utcnow)
Beispiel #30
0
 def __init__(self, text, utcnow=None):
     ''' constructor '''
     self.lsrs = []
     self.duplicates = 0
     TextProduct.__init__(self, text, utcnow=utcnow)
Beispiel #31
0
 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)