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


Python environment.Waves类代码示例

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


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

示例1: test_get_emulsification_wind

def test_get_emulsification_wind():
    wind = constant_wind(3., 0)
    water = Water()
    w = Waves(wind, water)

    print w.get_emulsification_wind(start_time)
    assert w.get_emulsification_wind(start_time) == 3.0
开发者ID:liuy0813,项目名称:PyGnome,代码行数:7,代码来源:test_waves.py

示例2: test_call_no_fetch_or_height

def test_call_no_fetch_or_height():
    "fully developed seas"
    w = Waves(test_wind_5, default_water)

    H, T, Wf, De = w.get_value(start_time)

    print H, T, Wf, De

    print "Need to check reasonable numbers"
开发者ID:liuy0813,项目名称:PyGnome,代码行数:9,代码来源:test_waves.py

示例3: test_compute_H

def test_compute_H():
    """can it compute a wave height at all?

       fetch unlimited
    """
    w = Waves(test_wind_5, default_water)
    H = w.compute_H(5)  # five m/s wind

    print H
开发者ID:liuy0813,项目名称:PyGnome,代码行数:9,代码来源:test_waves.py

示例4: test_pseudo_wind

def test_pseudo_wind(U):
    """
    should reverse the wave height computation
    at least for fetch-unlimited
    """
    w = Waves(test_wind_5, default_water)

    print "testing for U:", U
    # 0.707 compensates for RMS wave height
    assert round(w.pseudo_wind(w.compute_H(U) / 0.707), 5) == round(U, 8)
开发者ID:liuy0813,项目名称:PyGnome,代码行数:10,代码来源:test_waves.py

示例5: test_mean_wave_period

def test_mean_wave_period(U):
    """
    test the wave period
    """
    w = Waves(test_wind_5, default_water)

    print "testing for U:", U

    f = w.mean_wave_period(U)

    print f
开发者ID:liuy0813,项目名称:PyGnome,代码行数:11,代码来源:test_waves.py

示例6: test_compute_H_fetch

def test_compute_H_fetch():
    """can it compute a wave height at all?

       fetch limited case
    """
    water = copy(default_water)
    water.fetch = 10000  # 10km
    w = Waves(test_wind_5, water)  # 10km
    H = w.compute_H(5)  # five m/s wind

    print H
开发者ID:satcomlabs,项目名称:PyGnome,代码行数:11,代码来源:test_waves.py

示例7: test_call_fetch

def test_call_fetch():

    water = copy(default_water)
    water.fetch = 1e4  # 10km
    w = Waves(test_wind_5, water)

    H, T, Wf, De = w.get_value(start_time)

    print H, T, Wf, De

    print "Need to check reasonable numbers"
开发者ID:liuy0813,项目名称:PyGnome,代码行数:11,代码来源:test_waves.py

示例8: test_call_height

def test_call_height():
    """ call with specified wave height """

    water = copy(default_water)
    water.wave_height = 1.0
    w = Waves(test_wind_5, water)

    H, T, Wf, De = w.get_value(start_time)

    print H, T, Wf, De

    assert H == 1.0
开发者ID:liuy0813,项目名称:PyGnome,代码行数:12,代码来源:test_waves.py

示例9: test_compute_H_fetch_huge

def test_compute_H_fetch_huge():
    """
    With a huge fetch, should be same as fetch-unlimited
    """
    water = copy(default_water)
    water.fetch = 1e100  # 10km
    w = Waves(test_wind_5, water)
    H_f = w.compute_H(5)  # five m/s wind
    w.fetch = None
    H_nf = w.compute_H(5)

    assert H_f == H_nf
开发者ID:satcomlabs,项目名称:PyGnome,代码行数:12,代码来源:test_waves.py

示例10: test_call_height

def test_call_height():
    """ call with specified wave height """

    water = copy(default_water)
    water.wave_height = 1.0
    w = Waves(test_wind_5, water)

    H, T, Wf, De = w.get_value(None, start_time)

    print H, T, Wf, De

    assert H == .707	# returns root mean square wave height
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:12,代码来源:test_waves.py

示例11: test_serialize_deseriailize

def test_serialize_deseriailize():
    'test serialize/deserialize for webapi'
    wind = constant_wind(1., 0)
    water = Water()
    w = Waves(wind, water)

    json_ = w.serialize()

    # deserialize and ensure the dict's are correct
    w2 = Waves.deserialize(json_)
    assert w2.wind == Wind.deserialize(json_['wind'])
    assert w2.water == Water.deserialize(json_['water'])
    assert w == w2
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:13,代码来源:test_waves.py

示例12: test_mean_wave_period_with_fetch

def test_mean_wave_period_with_fetch(U):
    """
    Test the wave period
    """
    print "testing for U:", U

    water = copy(default_water)
    water.fetch = 1e4  # 10km
    w = Waves(test_wind_5, water)  # 10km fetch

    T = w.mean_wave_period(U)

    print T
开发者ID:liuy0813,项目名称:PyGnome,代码行数:13,代码来源:test_waves.py

示例13: test_period_fetch

def test_period_fetch(U):
    """
    Test the wave period
    """
    water = copy(default_water)
    water.fetch = 1e4  # 10km
    w = Waves(test_wind_5, water)  # 10km fetch

    print "testing for U:", U

    T = w.comp_period(U)

    print T
开发者ID:satcomlabs,项目名称:PyGnome,代码行数:13,代码来源:test_waves.py

示例14: test_peak_wave_period

def test_peak_wave_period(wind_speed, expected):
    "fully developed seas"
    series = np.array((start_time, (wind_speed, 45)),
                      dtype=datetime_value_2d).reshape((1, ))
    test_wind = Wind(timeseries=series, units='meter per second')

    w = Waves(test_wind, default_water)

    print 'Wind speed:', w.wind.get_value(start_time)

    T_w = w.peak_wave_period(start_time)

    assert np.isclose(T_w, expected)
开发者ID:liuy0813,项目名称:PyGnome,代码行数:13,代码来源:test_waves.py

示例15: test_whitecap_fraction

def test_whitecap_fraction(U):
    """
    Fraction whitcapping -- doesn't really check values
    but should catch gross errors!
    """
    print "testing for U:", U

    w = Waves(test_wind_5, default_water)
    f = w.whitecap_fraction(U)

    assert f >= 0.0
    assert f <= 1.0

    if U == 4.0:
        # assert round(f, 8) == round(0.05 / 3.85, 8)
        # included the .5 factor from ADIOS2
        assert round(f, 8) == round(0.05 / 3.85 / 2, 8)
开发者ID:liuy0813,项目名称:PyGnome,代码行数:17,代码来源:test_waves.py


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