当前位置: 首页>>代码示例>>Python>>正文


Python util.get_test_file函数代码示例

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


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


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