• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.get_test_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyiem.util.get_test_file函数的典型用法代码示例。如果您正苦于以下问题:Python get_test_file函数的具体用法?Python get_test_file怎么用?Python get_test_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_test_file函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_mcdparser

def test_mcdparser(dbcursor):
    ''' Test Parsing of MCD Product '''
    prod = parser(get_test_file('MCD_MPD/SWOMCD.txt'))
    assert abs(prod.geometry.area - 4.302) < 0.001
    assert prod.discussion_num == 1525
    assert prod.attn_wfo[2] == 'DLH'
    ans = "PORTIONS OF NRN WI AND THE UPPER PENINSULA OF MI"
    assert prod.areas_affected == ans

    # With probability this time
    prod = parser(get_test_file('MCD_MPD/SWOMCDprob.txt'))
    assert abs(prod.geometry.area - 2.444) < 0.001
    assert prod.watch_prob == 20

    jmsg = prod.get_jabbers('http://localhost')
    ans = (
        '<p>Storm Prediction Center issues '
        '<a href="http://www.spc.noaa.gov/'
        'products/md/2013/md1678.html">Mesoscale Discussion #1678</a> '
        '[watch probability: 20%] (<a href="http://localhost'
        '?pid=201308091725-KWNS-ACUS11-SWOMCD">View text</a>)</p>')
    assert jmsg[0][1] == ans
    ans = (
        'Storm Prediction Center issues Mesoscale Discussion #1678 '
        '[watch probability: 20%] '
        'http://www.spc.noaa.gov/products/md/2013/md1678.html')
    assert jmsg[0][0] == ans
    ans = utc(2013, 8, 9, 17, 25)
    assert prod.sts == ans
    ans = utc(2013, 8, 9, 19, 30)
    assert prod.ets == ans

    prod.database_save(dbcursor)
开发者ID:akrherz,项目名称:pyIEM,代码行数:33,代码来源:test_mcd.py


示例2: 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)
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_products_vtec.py


示例3: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:28,代码来源:test_products_vtec.py


示例4: test_read

def test_read():
    """Can we process an entire file?"""
    for line in get_test_file("NCEI/DS3505.txt", fponly=True):
        data = parser(line.decode('ascii').strip(), 'ENJA')
        assert data is not None

    for line in get_test_file("NCEI/DS3505_KAMW_2016.txt", fponly=True):
        data = parser(line.decode('ascii').strip(), 'KAMW')
        assert data is not None
开发者ID:akrherz,项目名称:pyIEM,代码行数:9,代码来源:test_ds3505.py


示例5: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:10,代码来源:test_products_vtec.py


示例6: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:10,代码来源:test_products_vtec.py


示例7: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:50,代码来源:test_products_vtec.py


示例8: test_ugc_error130214

def test_ugc_error130214():
    """ Check parsing of SPSJAX  """
    tp = product.TextProduct(get_test_file('SPSJAX.txt'))
    assert tp.segments[0].ugcs, [
        ugc.UGC("FL", "Z", 23), ugc.UGC("FL", "Z", 25),
        ugc.UGC("FL", "Z", 30), ugc.UGC("FL", "Z", 31),
        ugc.UGC("FL", "Z", 32)]
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_product.py


示例9: test_170815_pywwa_issue3

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
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_sigmet.py


示例10: test_190503_badgeom

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
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_sigmet.py


示例11: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_products_vtec.py


示例12: test_170612_nullgeom

def test_170612_nullgeom(dbcursor):
    """See why this has an error with null geom reported"""
    spc = parser(get_test_file('SPCPTS/PTSD48_nullgeom.txt'))
    # spc.draw_outlooks()
    spc.sql(dbcursor)
    outlook = spc.get_outlook('ANY SEVERE', '0.15', 4)
    assert abs(outlook.geometry.area - 56.84) < 0.01
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_spcpts.py


示例13: test_080731_invalid

def test_080731_invalid():
    """Make sure that the SIG wind threshold does not eat the US"""
    spc = parser(get_test_file('SPCPTS/PTSDY1_biggeom.txt'))
    # spc.draw_outlooks()
    outlook = spc.get_outlook('WIND', 'SIGN', 1)
    assert abs(outlook.geometry.area - 15.82) < 0.01
    assert len(spc.warnings) == 1
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_spcpts.py


示例14: test_170809_nocrcrlf

def test_170809_nocrcrlf():
    """Product fails WMO parsing due to usage of RTD as bbb field"""
    utcnow = utc(2017, 8, 9, 9)
    prod = PARSER(
        get_test_file("METAR/rtd_bbb.txt"), utcnow=utcnow,
        nwsli_provider=NWSLI_PROVIDER)
    assert len(prod.metars) == 1
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_metarcollect.py


示例15: test_future

def test_future():
    """Can we handle products that are around the first"""
    utcnow = utc(2017, 12, 1)
    prod = PARSER(get_test_file("METAR/first.txt"), utcnow=utcnow)
    assert len(prod.metars) == 2
    assert prod.metars[0].time.month == 11
    assert prod.metars[1].time.month == 12
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_metarcollect.py


示例16: test_valid_nomnd

def test_valid_nomnd():
    """ check valid (no Mass News) Parsing """
    utcnow = utc(2012, 11, 27)
    tp = product.TextProduct(
        get_test_file('AFD_noMND.txt'), utcnow=utcnow)
    ts = utc(2012, 11, 27, 0, 1)
    assert tp.valid == ts
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_product.py


示例17: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:16,代码来源:test_products_vtec.py


示例18: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_products_vtec.py


示例19: 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)
开发者ID:akrherz,项目名称:pyIEM,代码行数:7,代码来源:test_products_vtec.py


示例20: 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
开发者ID:akrherz,项目名称:pyIEM,代码行数:16,代码来源:test_products_vtec.py



注:本文中的pyiem.util.get_test_file函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.utc函数代码示例发布时间:2022-05-25
下一篇:
Python util.get_dbconn函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap