示例#1
0
def test_170815_pywwa_issue3():
    """This example was in pyWWA issues list, so lets test here"""
    utcnow = utc(2015, 9, 30, 16, 56)

    tp = parser(get_test_file('SIGMETS/SIGE.txt'), utcnow,
                nwsli_provider=NWSLI_PROVIDER)
    assert len(tp.sigmets) == 4
示例#2
0
def test_190503_badgeom():
    """This SIGMET produced a traceback in prod."""
    utcnow = utc(2019, 5, 3, 18, 25)
    tp = parser(
        get_test_file('SIGMETS/SIGC_badgeom.txt'), utcnow,
        nwsli_provider=NWSLI_PROVIDER)
    assert len(tp.sigmets) == 4
示例#3
0
def test_190503_badgeom():
    """This SIGMET produced a traceback in prod."""
    utcnow = utc(2019, 5, 3, 18, 25)
    tp = parser(get_test_file('SIGMETS/SIGC_badgeom.txt'),
                utcnow,
                nwsli_provider=NWSLI_PROVIDER)
    assert len(tp.sigmets) == 4
示例#4
0
def test_170815_pywwa_issue3():
    """This example was in pyWWA issues list, so lets test here"""
    utcnow = utc(2015, 9, 30, 16, 56)

    tp = parser(get_test_file('SIGMETS/SIGE.txt'),
                utcnow,
                nwsli_provider=NWSLI_PROVIDER)
    assert len(tp.sigmets) == 4
示例#5
0
 def process_data(self, buf):
     """ Process the product """
     try:
         prod = parser(buf, nwsli_provider=LOCS)
         # prod.draw()
     except Exception, myexp:
         common.email_error(myexp, buf)
         return
示例#6
0
def test_sigpat():
    """ Make sure we don't have another failure with geom parsing """
    utcnow = utc(2014, 8, 11, 12, 34)
    tp = parser(get_test_file('SIGMETS/SIGPAT.txt'), utcnow)
    j = tp.get_jabbers('http://localhost', 'http://localhost')
    assert abs(tp.sigmets[0].geom.area - 33.71) < 0.01
    assert tp.sigmets[0].sts == utc(2014, 8, 11, 12, 35)
    assert tp.sigmets[0].ets == utc(2014, 8, 11, 16, 35)
    assert j[0][0] == 'PHFO issues SIGMET TANGO 1 till 1635 UTC'
示例#7
0
def test_sigpat():
    """ Make sure we don't have another failure with geom parsing """
    utcnow = utc(2014, 8, 11, 12, 34)
    tp = parser(get_test_file("SIGMETS/SIGPAT.txt"), utcnow)
    j = tp.get_jabbers("http://localhost", "http://localhost")
    assert abs(tp.sigmets[0].geom.area - 33.71) < 0.01
    assert tp.sigmets[0].sts == utc(2014, 8, 11, 12, 35)
    assert tp.sigmets[0].ets == utc(2014, 8, 11, 16, 35)
    assert j[0][0] == "PHFO issues SIGMET TANGO 1 till 1635 UTC"
示例#8
0
 def test_sigpat(self):
     """ Make sure we don't have another failure with geom parsing """
     utcnow = utc(2014, 8, 11, 12, 34)
     tp = parser(get_file('SIGPAT.txt'), utcnow)
     j = tp.get_jabbers('http://localhost', 'http://localhost')
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 33.71, 2)
     self.assertEquals(tp.sigmets[0].sts, utc(2014, 8, 11, 12, 35))
     self.assertEquals(tp.sigmets[0].ets, utc(2014, 8, 11, 16, 35))
     self.assertEquals(j[0][0], 'PHFO issues SIGMET TANGO 1 till 1635 UTC')
示例#9
0
def test_150915_line():
    """ See about parsing a SIGMET LINE """
    utcnow = utc(2015, 9, 15, 2, 55)
    ugc_provider = {}
    nwsli_provider = {
        "MSP": dict(lon=-83.39, lat=44.45),
        "MCW": dict(lon=-85.50, lat=42.79),
    }
    tp = parser(get_test_file('SIGMETS/SIGC_line.txt'), utcnow, ugc_provider,
                nwsli_provider)
    assert abs(tp.sigmets[0].geom.area - 0.47) < 0.01
示例#10
0
 def test_150915_line(self):
     """ See about parsing a SIGMET LINE """
     utcnow = utc(2015, 9, 15, 2, 55)
     ugc_provider = {}
     nwsli_provider = {
         "MSP": dict(lon=-83.39, lat=44.45),
         "MCW": dict(lon=-85.50, lat=42.79),
     }
     tp = parser(get_file('SIGC_line.txt'), utcnow, ugc_provider,
                 nwsli_provider)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 0.47, 2)
示例#11
0
 def test_150915_isol(self):
     """ See about parsing a SIGMET ISOL """
     utcnow = utc(2015, 9, 12, 23, 55)
     ugc_provider = {}
     nwsli_provider = {
         "FTI": dict(lon=-83.39, lat=44.45),
         "CME": dict(lon=-85.50, lat=42.79),
     }
     tp = parser(get_file('SIGC_ISOL.txt'), utcnow, ugc_provider,
                 nwsli_provider)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 0.30, 2)
     self.assertAlmostEquals(tp.sigmets[1].geom.area, 0.30, 2)
示例#12
0
def test_150915_isol():
    """ See about parsing a SIGMET ISOL """
    utcnow = utc(2015, 9, 12, 23, 55)
    ugc_provider = {}
    nwsli_provider = {
        "FTI": dict(lon=-83.39, lat=44.45),
        "CME": dict(lon=-85.50, lat=42.79),
    }
    tp = parser(get_test_file('SIGMETS/SIGC_ISOL.txt'), utcnow, ugc_provider,
                nwsli_provider)
    assert abs(tp.sigmets[0].geom.area - 0.30) < 0.01
    assert abs(tp.sigmets[1].geom.area - 0.30) < 0.01
示例#13
0
def test_150915_isol():
    """ See about parsing a SIGMET ISOL """
    utcnow = utc(2015, 9, 12, 23, 55)
    ugc_provider = {}
    nwsli_provider = {
        "FTI": dict(lon=-83.39, lat=44.45),
        "CME": dict(lon=-85.50, lat=42.79),
    }
    tp = parser(get_test_file('SIGMETS/SIGC_ISOL.txt'), utcnow, ugc_provider,
                nwsli_provider)
    assert abs(tp.sigmets[0].geom.area - 0.30) < 0.01
    assert abs(tp.sigmets[1].geom.area - 0.30) < 0.01
示例#14
0
def test_50e():
    """ See about parsing 50E properly """
    utcnow = utc(2014, 8, 11, 18, 55)
    ugc_provider = {}
    nwsli_provider = {
        "ASP": dict(lon=-83.39, lat=44.45),
        "ECK": dict(lon=-82.72, lat=43.26),
        "GRR": dict(lon=-85.50, lat=42.79),
    }

    tp = parser(get_test_file('SIGMETS/SIGE3.txt'), utcnow, ugc_provider,
                nwsli_provider)
    assert abs(tp.sigmets[0].geom.area - 2.15) < 0.01
示例#15
0
def test_50e():
    """ See about parsing 50E properly """
    utcnow = utc(2014, 8, 11, 18, 55)
    ugc_provider = {}
    nwsli_provider = {
        "ASP": dict(lon=-83.39, lat=44.45),
        "ECK": dict(lon=-82.72, lat=43.26),
        "GRR": dict(lon=-85.50, lat=42.79),
    }

    tp = parser(get_test_file('SIGMETS/SIGE3.txt'), utcnow, ugc_provider,
                nwsli_provider)
    assert abs(tp.sigmets[0].geom.area - 2.15) < 0.01
示例#16
0
    def test_50e(self):
        """ See about parsing 50E properly """
        utcnow = utc(2014, 8, 11, 18, 55)
        ugc_provider = {}
        nwsli_provider = {
            "ASP": dict(lon=-83.39, lat=44.45),
            "ECK": dict(lon=-82.72, lat=43.26),
            "GRR": dict(lon=-85.50, lat=42.79),
        }

        tp = parser(get_file('SIGE3.txt'), utcnow, ugc_provider,
                    nwsli_provider)
        # tp.draw()
        self.assertAlmostEquals(tp.sigmets[0].geom.area, 2.15, 2)
示例#17
0
def test_150915_line():
    """ See about parsing a SIGMET LINE """
    utcnow = utc(2015, 9, 15, 2, 55)
    ugc_provider = {}
    nwsli_provider = {
        "MSP": dict(lon=-83.39, lat=44.45),
        "MCW": dict(lon=-85.50, lat=42.79),
    }
    tp = parser(
        get_test_file("SIGMETS/SIGC_line.txt"),
        utcnow,
        ugc_provider,
        nwsli_provider,
    )
    assert abs(tp.sigmets[0].geom.area - 0.47) < 0.01
示例#18
0
    def test_sigc(self):
        """ See about parsing SIGC """
        utcnow = utc(2014, 8, 11, 16, 55)
        ugc_provider = {}
        nwsli_provider = {}
        for sid in ("MSL,SJI,MLU,LIT,BTR,LEV,LCH,IAH,YQT,SAW,SAT,DYC,AXC,"
                    "ODI,DEN,TBE,ADM,JCT,INK,ELP").split(","):
            nwsli_provider[sid] = dict(lon=-99, lat=45)

        tp = parser(get_file('SIGC.txt'), utcnow, ugc_provider, nwsli_provider)
        # tp.draw()
        j = tp.get_jabbers('http://localhost', 'http://localhost')
        self.assertEquals(tp.sigmets[0].ets, utc(2014, 8, 11, 18, 55))
        self.assertEquals(j[0][0], ('KKCI issues SIGMET 62C for AL MS LA AR '
                                    'till 1855 UTC'))
        self.assertEquals(j[1][0], ('KKCI issues SIGMET 63C for LA TX AND MS '
                                    'LA TX CSTL WTRS till 1855 UTC'))
示例#19
0
 def test_170815_pywwa_issue3(self):
     """This example was in pyWWA issues list, so lets test here"""
     utcnow = utc(2015, 9, 30, 16, 56)
     nwsli_provider = {
         "EWC": dict(lon=-83.39, lat=44.45),
         "HNN": dict(lon=-85.50, lat=42.79),
         "VXV": dict(lon=-85.50, lat=42.79),
         "RDU": dict(lon=-85.50, lat=42.79),
         "FLO": dict(lon=-85.50, lat=42.79),
         "VRB": dict(lon=-85.50, lat=42.79),
         "MIA": dict(lon=-85.50, lat=42.79),
         "EYW": dict(lon=-85.50, lat=42.79),
         "ROD": dict(lon=-85.50, lat=42.79),
         "CVG": dict(lon=-85.50, lat=42.79),
     }
     tp = parser(get_file('SIGE.txt'),
                 utcnow,
                 nwsli_provider=nwsli_provider)
     self.assertEquals(len(tp.sigmets), 4)
示例#20
0
def test_sigc():
    """ See about parsing SIGC """
    utcnow = utc(2014, 8, 11, 16, 55)
    ugc_provider = {}
    nwsli_provider = {}
    for sid in ("MSL,SJI,MLU,LIT,BTR,LEV,LCH,IAH,YQT,SAW,SAT,DYC,AXC,"
                "ODI,DEN,TBE,ADM,JCT,INK,ELP").split(","):
        nwsli_provider[sid] = dict(lon=-99, lat=45)

    tp = parser(
        get_test_file('SIGMETS/SIGC.txt'), utcnow, ugc_provider,
        nwsli_provider
    )
    j = tp.get_jabbers('http://localhost', 'http://localhost')
    assert tp.sigmets[0].ets == utc(2014, 8, 11, 18, 55)
    ans = 'KKCI issues SIGMET 62C for AL MS LA AR till 1855 UTC'
    assert j[0][0] == ans
    ans = (
        'KKCI issues SIGMET 63C for LA TX AND MS LA TX CSTL WTRS till 1855 UTC'
    )
    assert j[1][0] == ans
示例#21
0
def test_sigc():
    """ See about parsing SIGC """
    utcnow = utc(2014, 8, 11, 16, 55)
    ugc_provider = {}
    nwsli_provider = {}
    for sid in (
        "MSL,SJI,MLU,LIT,BTR,LEV,LCH,IAH,YQT,SAW,SAT,DYC,AXC,"
        "ODI,DEN,TBE,ADM,JCT,INK,ELP"
    ).split(","):
        nwsli_provider[sid] = dict(lon=-99, lat=45)

    tp = parser(
        get_test_file("SIGMETS/SIGC.txt"), utcnow, ugc_provider, nwsli_provider
    )
    j = tp.get_jabbers("http://localhost", "http://localhost")
    assert tp.sigmets[0].ets == utc(2014, 8, 11, 18, 55)
    ans = "KKCI issues SIGMET 62C for AL MS LA AR till 1855 UTC"
    assert j[0][0] == ans
    ans = (
        "KKCI issues SIGMET 63C for LA TX AND MS LA TX CSTL WTRS till 1855 UTC"
    )
    assert j[1][0] == ans
示例#22
0
 def test_sigaoa(self):
     """ SIGAOA """
     utcnow = utc(2014, 8, 11, 19, 15)
     tp = parser(get_file('SIGA0A.txt'), utcnow)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 24.35, 2)
示例#23
0
 def test_140813_line(self):
     """ See about parsing a SIGMET that is a either side of line """
     utcnow = utc(2014, 8, 12, 13, 15)
     tp = parser(get_file('SIGP0A_line.txt'), utcnow)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 4.32, 2)
示例#24
0
 def test_140815_cancel(self):
     """ See about parsing a SIGMET that is a either side of line """
     utcnow = utc(2014, 8, 15, 23, 41)
     tp = parser(get_file('SIG_cancel.txt'), utcnow)
     self.assertAlmostEquals(len(tp.sigmets), 0)
示例#25
0
 def test_150915_nospace(self):
     """ See about parsing a SIGMET that has no spaces """
     utcnow = utc(2015, 9, 15, 15, 41)
     tp = parser(get_file('SIGAX.txt'), utcnow)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 23.47, 2)
示例#26
0
 def test_140907_circle(self):
     """ See about parsing a SIGMET that is circle? """
     utcnow = utc(2014, 9, 6, 22, 15)
     tp = parser(get_file('SIGP0H.txt'), utcnow)
     self.assertAlmostEquals(tp.sigmets[0].geom.area, 11.70, 2)
示例#27
0
def test_140813_line():
    """ See about parsing a SIGMET that is a either side of line """
    utcnow = utc(2014, 8, 12, 13, 15)
    tp = parser(get_test_file("SIGMETS/SIGP0A_line.txt"), utcnow)
    assert abs(tp.sigmets[0].geom.area - 4.32) < 0.01
示例#28
0
def test_150917_cancel():
    """Don't error out on a CANCELs SIGMET"""
    utcnow = utc(2015, 9, 17, 0, 0)
    tp = parser(get_test_file('SIGMETS/SIGPAP_cancel.txt'), utcnow)
    assert not tp.sigmets
示例#29
0
def test_140813_line():
    """ See about parsing a SIGMET that is a either side of line """
    utcnow = utc(2014, 8, 12, 13, 15)
    tp = parser(get_test_file('SIGMETS/SIGP0A_line.txt'), utcnow)
    assert abs(tp.sigmets[0].geom.area - 4.32) < 0.01
示例#30
0
def test_150921_sigpas():
    """Got an error with this product"""
    utcnow = utc(2015, 9, 21, 10, 57)
    tp = parser(get_test_file('SIGMETS/SIGPAS.txt'), utcnow)
    assert len(tp.sigmets) == 1
示例#31
0
def test_150915_nospace():
    """ See about parsing a SIGMET that has no spaces """
    utcnow = utc(2015, 9, 15, 15, 41)
    tp = parser(get_test_file('SIGMETS/SIGAX.txt'), utcnow)
    assert abs(tp.sigmets[0].geom.area - 23.47) < 0.01
示例#32
0
 def test_150921_sigpas(self):
     """Got an error with this product"""
     utcnow = utc(2015, 9, 21, 10, 57)
     tp = parser(get_file('SIGPAS.txt'), utcnow)
     self.assertEquals(len(tp.sigmets), 1)
示例#33
0
def test_sigaob():
    """ See about parsing 50E properly """
    utcnow = utc(2014, 8, 11, 19, 15)
    tp = parser(get_test_file('SIGMETS/SIGA0B.txt'), utcnow)
    assert not tp.sigmets
示例#34
0
def test_sigaoa():
    """ SIGAOA """
    utcnow = utc(2014, 8, 11, 19, 15)
    tp = parser(get_test_file("SIGMETS/SIGA0A.txt"), utcnow)
    assert abs(tp.sigmets[0].geom.area - 24.35) < 0.01
示例#35
0
def test_140907_circle():
    """ See about parsing a SIGMET that is circle? """
    utcnow = utc(2014, 9, 6, 22, 15)
    tp = parser(get_test_file('SIGMETS/SIGP0H.txt'), utcnow)
    assert abs(tp.sigmets[0].geom.area - 11.70) < 0.01
示例#36
0
 def test_sigaob(self):
     """ See about parsing 50E properly """
     utcnow = utc(2014, 8, 11, 19, 15)
     tp = parser(get_file('SIGA0B.txt'), utcnow)
     self.assertEquals(len(tp.sigmets), 0)
示例#37
0
def test_150917_cancel():
    """Don't error out on a CANCELs SIGMET"""
    utcnow = utc(2015, 9, 17, 0, 0)
    tp = parser(get_test_file("SIGMETS/SIGPAP_cancel.txt"), utcnow)
    assert not tp.sigmets
示例#38
0
def test_sigaob():
    """ See about parsing 50E properly """
    utcnow = utc(2014, 8, 11, 19, 15)
    tp = parser(get_test_file("SIGMETS/SIGA0B.txt"), utcnow)
    assert not tp.sigmets
示例#39
0
def test_140907_circle():
    """ See about parsing a SIGMET that is circle? """
    utcnow = utc(2014, 9, 6, 22, 15)
    tp = parser(get_test_file("SIGMETS/SIGP0H.txt"), utcnow)
    assert abs(tp.sigmets[0].geom.area - 11.70) < 0.01
示例#40
0
def test_140815_cancel():
    """ See about parsing a SIGMET that is a either side of line """
    utcnow = utc(2014, 8, 15, 23, 41)
    tp = parser(get_test_file('SIGMETS/SIG_cancel.txt'), utcnow)
    assert not tp.sigmets
示例#41
0
def test_sigaoa():
    """ SIGAOA """
    utcnow = utc(2014, 8, 11, 19, 15)
    tp = parser(get_test_file('SIGMETS/SIGA0A.txt'), utcnow)
    assert abs(tp.sigmets[0].geom.area - 24.35) < 0.01
示例#42
0
 def test_150930_sigak2(self):
     """Got an error with this product"""
     utcnow = utc(2015, 9, 30, 16, 56)
     tp = parser(get_file('SIGAK2.txt'), utcnow)
     self.assertEquals(len(tp.sigmets), 0)
示例#43
0
def test_150930_sigak2():
    """Got an error with this product"""
    utcnow = utc(2015, 9, 30, 16, 56)
    tp = parser(get_test_file("SIGMETS/SIGAK2.txt"), utcnow)
    assert not tp.sigmets
示例#44
0
 def test_150917_cancel(self):
     """Don't error out on a CANCELs SIGMET"""
     utcnow = utc(2015, 9, 17, 0, 0)
     tp = parser(get_file('SIGPAP_cancel.txt'), utcnow)
     self.assertEquals(len(tp.sigmets), 0)
示例#45
0
def test_150921_sigpas():
    """Got an error with this product"""
    utcnow = utc(2015, 9, 21, 10, 57)
    tp = parser(get_test_file("SIGMETS/SIGPAS.txt"), utcnow)
    assert len(tp.sigmets) == 1
示例#46
0
def test_140815_cancel():
    """ See about parsing a SIGMET that is a either side of line """
    utcnow = utc(2014, 8, 15, 23, 41)
    tp = parser(get_test_file("SIGMETS/SIG_cancel.txt"), utcnow)
    assert not tp.sigmets
示例#47
0
def test_150930_sigak2():
    """Got an error with this product"""
    utcnow = utc(2015, 9, 30, 16, 56)
    tp = parser(get_test_file('SIGMETS/SIGAK2.txt'), utcnow)
    assert not tp.sigmets