本文整理汇总了Python中pyiem.nws.products.vtec.vtecparser函数的典型用法代码示例。如果您正苦于以下问题:Python vtecparser函数的具体用法?Python vtecparser怎么用?Python vtecparser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtecparser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_181228_issue76_sbwtable
def test_181228_issue76_sbwtable(dbcursor):
"""Can we locate the current SBW table with polys in the future."""
prod = vtecparser(get_test_file('FLWMOB/FLW.txt'))
prod.sql(dbcursor)
prod = vtecparser(get_test_file('FLWMOB/FLS.txt'))
prod.sql(dbcursor)
assert not filter_warnings(prod.warnings)
示例2: test_140604_sbwupdate
def test_140604_sbwupdate(dbcursor):
"""Make sure we are updating the right info in the sbw table """
utcnow = utc(2014, 6, 4)
dbcursor.execute("""DELETE from sbw_2014 where
wfo = 'LMK' and eventid = 95 and phenomena = 'SV' and
significance = 'W' """)
dbcursor.execute("""DELETE from warnings_2014 where
wfo = 'LMK' and eventid = 95 and phenomena = 'SV' and
significance = 'W' """)
prod = vtecparser(get_test_file('SVRLMK_1.txt'), utcnow=utcnow)
prod.sql(dbcursor)
dbcursor.execute("""SELECT expire from sbw_2014 WHERE
wfo = 'LMK' and eventid = 95 and phenomena = 'SV' and
significance = 'W' """)
assert dbcursor.rowcount == 1
prod = vtecparser(get_test_file('SVRLMK_2.txt'), utcnow=utcnow)
prod.sql(dbcursor)
dbcursor.execute("""SELECT expire from sbw_2014 WHERE
wfo = 'LMK' and eventid = 95 and phenomena = 'SV' and
significance = 'W' """)
assert dbcursor.rowcount == 3
warnings = filter_warnings(prod.warnings)
assert not warnings
示例3: test_150115_correction_sbw
def test_150115_correction_sbw(dbcursor):
""" FLWMHX make sure a correction does not result in two polygons """
prod = vtecparser(get_test_file('FLWMHX/0.txt'))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
prod = vtecparser(get_test_file('FLWMHX/1.txt'))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
示例4: test_171121_issue45
def test_171121_issue45(dbcursor):
"""Do we alert on duplicated ETNs?"""
utcnow = utc(2017, 4, 20, 21, 33)
prod = vtecparser(get_test_file('vtec/NPWDMX_0.txt'), utcnow=utcnow)
prod.sql(dbcursor)
utcnow = utc(2017, 11, 20, 21, 33)
prod = vtecparser(get_test_file('vtec/NPWDMX_1.txt'), utcnow=utcnow)
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert len(warnings) == 1
示例5: test_vtec_series
def test_vtec_series(dbcursor):
"""Test a lifecycle of WSW products """
prod = vtecparser(get_test_file('WSWDMX/WSW_00.txt'))
assert prod.afos == 'WSWDMX'
prod.sql(dbcursor)
# Did Marshall County IAZ049 get a ZR.Y
dbcursor.execute("""
SELECT issue from warnings_2013 WHERE
wfo = 'DMX' and eventid = 1 and phenomena = 'ZR' and
significance = 'Y' and status = 'EXB'
and ugc = 'IAZ049'
""")
assert dbcursor.rowcount == 1
prod = vtecparser(get_test_file('WSWDMX/WSW_01.txt'))
assert prod.afos == 'WSWDMX'
prod.sql(dbcursor)
# Is IAZ006 in CON status with proper end time
answer = utc(2013, 1, 28, 6)
dbcursor.execute("""SELECT expire from warnings_2013 WHERE
wfo = 'DMX' and eventid = 1 and phenomena = 'WS' and
significance = 'W' and status = 'CON'
and ugc = 'IAZ006' """)
assert dbcursor.rowcount == 1
row = dbcursor.fetchone()
assert row[0] == answer
# No change
for i in range(2, 9):
prod = vtecparser(get_test_file('WSWDMX/WSW_%02i.txt' % (i,)))
assert prod.afos == 'WSWDMX'
prod.sql(dbcursor)
prod = vtecparser(get_test_file('WSWDMX/WSW_09.txt'))
assert prod.afos == 'WSWDMX'
prod.sql(dbcursor)
# IAZ006 should be cancelled
answer = utc(2013, 1, 28, 5, 38)
dbcursor.execute("""SELECT expire from warnings_2013 WHERE
wfo = 'DMX' and eventid = 1 and phenomena = 'WS' and
significance = 'W' and status = 'CAN'
and ugc = 'IAZ006' """)
assert dbcursor.rowcount == 1
row = dbcursor.fetchone()
assert row[0] == answer
示例6: test_issue9
def test_issue9(dbcursor):
"""A product crossing year bondary"""
utcnow = utc(2017, 12, 31, 9, 24)
prod = vtecparser(get_test_file('vtec/crosses_0.txt'), utcnow=utcnow)
prod.sql(dbcursor)
utcnow = utc(2018, 1, 1, 16, 0)
prod = vtecparser(get_test_file('vtec/crosses_1.txt'), utcnow=utcnow)
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
# We used to emit a warning for this, but not any more
assert not warnings
utcnow = utc(2018, 1, 1, 21, 33)
prod = vtecparser(get_test_file('vtec/crosses_2.txt'), utcnow=utcnow)
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
示例7: test_141023_upgrade
def test_141023_upgrade(dbcursor):
""" See that we can handle the upgrade and downgrade dance """
for i in range(1, 8):
prod = vtecparser(get_test_file('NPWBOX/NPW_%02i.txt' % (i,)))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
示例8: test_170115_table_failure
def test_170115_table_failure(dbcursor):
"""Test WSW series for issues"""
for i in range(12):
print('Parsing Product: %s.txt' % (i,))
prod = vtecparser(get_test_file('WSWAMA/WSWAMA_%02i.txt' % (i,)))
prod.sql(dbcursor)
assert not filter_warnings(prod.warnings)
示例9: test_140610_no_vtec_time
def test_140610_no_vtec_time(dbcursor):
""" A VTEC Product with both 0000 for start and end time, sigh """
utcnow = utc(2014, 6, 10, 0, 56)
prod = vtecparser(get_test_file('FLSLZK_notime.txt'), utcnow=utcnow)
prod.sql(dbcursor)
assert prod.segments[0].vtec[0].begints is None
assert prod.segments[0].vtec[0].endts is None
示例10: test_wcn_updates
def test_wcn_updates():
""" Make sure our Tags and svs_special works for combined message """
utcnow = utc(2014, 6, 6, 20, 37)
ugc_provider = {}
for u in range(1, 201, 2):
n = 'a' * int(min((u+1/2), 40))
for st in ['AR', 'MS', 'TN', 'MO']:
ugc_provider["%sC%03i" % (st, u)] = UGC(st, 'C', "%03i" % (u,),
name=n, wfos=['DMX'])
prod = vtecparser(get_test_file('WCNMEG.txt'), utcnow=utcnow,
ugc_provider=ugc_provider)
j = prod.get_jabbers('http://localhost', 'http://localhost')
ans = (
'MEG updates Severe Thunderstorm Watch (expands area to include '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [MO] and 11 counties in '
'[TN], continues 12 counties in [AR] and '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [MO] and 22 counties in '
'[MS] and aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, '
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [TN]) till Jun 6, 7:00 PM '
'CDT. http://localhost2014-O-EXA-KMEG-SV-A-0240'
)
assert j[0][0] == ans
示例11: test_routine
def test_routine(dbcursor):
"""what can we do with a ROU VTEC product """
utcnow = utc(2014, 6, 19, 2, 56)
prod = vtecparser(get_test_file('FLWMKX_ROU.txt'), utcnow=utcnow)
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
示例12: test_151225_extfuture
def test_151225_extfuture(dbcursor):
"""Warning failure jumps states!"""
# /O.NEW.KPAH.FL.W.0093.151227T0517Z-151228T1727Z/
prod = vtecparser(get_test_file('FLWPAH/FLWPAH_1.txt'))
prod.sql(dbcursor)
dbcursor.execute("""
SELECT ugc, issue, expire from warnings_2015 where wfo = 'PAH'
and phenomena = 'FL' and eventid = 93 and significance = 'W'
and status = 'NEW'
""")
assert dbcursor.rowcount == 2
# /O.EXT.KPAH.FL.W.0093.151227T0358Z-151229T0442Z/
prod = vtecparser(get_test_file('FLWPAH/FLWPAH_2.txt'))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert len(warnings) == 2
示例13: test_141210_continues
def test_141210_continues(dbcursor):
""" See that we handle CON with infinite time A-OK """
for i in range(0, 2):
prod = vtecparser(get_test_file('FFAEKA/%i.txt' % (i,)))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings
示例14: test_150102_multiyear
def test_150102_multiyear(dbcursor):
""" WSWOUN See how well we span multiple years """
for i in range(13):
print(datetime.datetime.utcnow())
print('Parsing Product: %s.txt' % (i,))
prod = vtecparser(get_test_file('WSWOUN/%i.txt' % (i,)))
prod.sql(dbcursor)
# Make sure there are no null issue times
dbcursor.execute("""
SELECT count(*) from warnings_2014
where wfo = 'OUN' and eventid = 16
and phenomena = 'WW' and significance = 'Y'
and issue is null
""")
assert dbcursor.fetchone()[0] == 0
if i == 5:
dbcursor.execute("""
SELECT issue from warnings_2014
WHERE ugc = 'OKZ036' and wfo = 'OUN' and eventid = 16
and phenomena = 'WW' and significance = 'Y'
""")
row = dbcursor.fetchone()
assert row[0] == utc(2015, 1, 1, 6, 0)
warnings = filter_warnings(prod.warnings)
warnings = filter_warnings(warnings, "Segment has duplicated")
warnings = filter_warnings(warnings, "VTEC Product appears to c")
assert not warnings
示例15: test_160912_missing
def test_160912_missing(dbcursor):
"""see why this series failed in production"""
for i in range(4):
prod = vtecparser(get_test_file("RFWVEF/RFW_%02i.txt" % (i,)))
prod.sql(dbcursor)
warnings = filter_warnings(prod.warnings)
assert not warnings