Exemple #1
0
    def __init__(self, text, tp):
        """ Constructor """
        self.unixtext = text
        self.tp = tp  # Reference to parent
        self.ugcs, self.ugcexpire = ugc.parse(text, tp.valid,
                                              ugc_provider=tp.ugc_provider)
        self.vtec = vtec.parse(text)
        self.headlines = self.parse_headlines()
        self.hvtec = hvtec.parse(text, nwsli_provider=tp.nwsli_provider)

        # TIME...MOT...LOC Stuff!
        self.tml_giswkt = None
        self.tml_valid = None
        self.tml_sknt = None
        self.tml_dir = None
        self.process_time_mot_loc()

        #
        self.giswkt = None
        self.sbw = self.process_latlon()

        # tags
        self.windtag = None
        self.windtagunits = None
        self.hailtag = None
        self.haildirtag = None
        self.winddirtag = None
        self.tornadotag = None
        self.tornadodamagetag = None
        self.process_tags()

        self.bullets = self.process_bullets()
Exemple #2
0
    def __init__(self, text, tp):
        """ Constructor """
        self.unixtext = text
        self.tp = tp  # Reference to parent
        self.ugcs, self.ugcexpire = ugc.parse(text, tp.valid,
                                              ugc_provider=tp.ugc_provider)
        self.vtec = vtec.parse(text)
        self.headlines = self.parse_headlines()
        self.hvtec = hvtec.parse(text, nwsli_provider=tp.nwsli_provider)

        # TIME...MOT...LOC Stuff!
        self.tml_giswkt = None
        self.tml_valid = None
        self.tml_sknt = None
        self.tml_dir = None
        self.process_time_mot_loc()

        #
        self.giswkt = None
        self.sbw = self.process_latlon()

        # tags
        self.windtag = None
        self.windtagunits = None
        self.hailtag = None
        self.haildirtag = None
        self.winddirtag = None
        self.tornadotag = None
        self.waterspouttag = None
        self.tornadodamagetag = None
        self.is_emergency = False
        self.process_tags()

        self.bullets = self.process_bullets()
Exemple #3
0
def test_dups():
    """We had a false positive :("""
    segment = FakeObject()
    segment.tp = FakeObject()
    segment.tp.valid = datetime.datetime(2017, 5, 24, 12, 0)
    segment.vtec = parse(
        ('/O.UPG.KTWC.FW.A.0008.170525T1800Z-170526T0300Z/\n'
         '/O.NEW.KTWC.FW.W.0013.170525T1800Z-170526T0300Z/\n'
         '/O.UPG.KTWC.FW.A.0009.170526T1700Z-170527T0300Z/\n'
         '/O.NEW.KTWC.FW.W.0014.170526T1700Z-170527T0300Z/\n'))
    res = check_dup_ps(segment)
    assert not res
Exemple #4
0
def test_dups():
    """We had a false positive :("""
    segment = FakeObject()
    segment.tp = FakeObject()
    segment.tp.valid = datetime.datetime(2017, 5, 24, 12, 0)
    segment.vtec = parse((
        '/O.UPG.KTWC.FW.A.0008.170525T1800Z-170526T0300Z/\n'
        '/O.NEW.KTWC.FW.W.0013.170525T1800Z-170526T0300Z/\n'
        '/O.UPG.KTWC.FW.A.0009.170526T1700Z-170527T0300Z/\n'
        '/O.NEW.KTWC.FW.W.0014.170526T1700Z-170527T0300Z/\n'))
    res = check_dup_ps(segment)
    assert not res
Exemple #5
0
def test_product_string():
    """ check vtec.product_string() formatting """
    vc = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
    assert vc[0].product_string() == "issues Tornado Warning"
Exemple #6
0
def test_endts():
    """ check vtec.endts Parsing """
    vc = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
    ts = utc(2005, 8, 29, 18, 15)
    assert vc[0].endts == ts
Exemple #7
0
def test_begints():
    """ check vtec.begints Parsing """
    vc = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
    ts = utc(2005, 8, 29, 16, 51)
    assert vc[0].begints == ts
Exemple #8
0
def test_endstring():
    """Make sure that the end time string is empty for cancel action"""
    vc = vtec.parse("/O.CAN.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
    assert vc[0].get_end_string(None) == ''
Exemple #9
0
def test_get_id():
    """check that getID() works as we expect"""
    vc = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
    assert vc[0].get_id(2005) == '2005-KJAN-TO-W-0130'
Exemple #10
0
 def test_getID(self):
     ''' check that getID() works as we expect '''
     v = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
     self.assertEqual(v[0].getID(2005), '2005-KJAN-TO-W-0130')
Exemple #11
0
 def test_product_string(self):
     """ check vtec.product_string() formatting """
     v = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
     self.assertEqual("issues Tornado Warning", v[0].product_string())
Exemple #12
0
 def test_endts(self):
     """ check vtec.endts Parsing """
     v = vtec.parse("/O.NEW.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
     ts = datetime.datetime(2005, 8, 29, 18, 15)
     ts = ts.replace(tzinfo=pytz.timezone("UTC"))
     self.assertEqual(ts, v[0].endts)
Exemple #13
0
 def test_endstring(self):
     ''' Make sure that the end time string is empty for cancel action '''
     v = vtec.parse("/O.CAN.KJAN.TO.W.0130.050829T1651Z-050829T1815Z/")
     self.assertEqual('', v[0].get_end_string(None))