本文整理汇总了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
示例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"
示例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
示例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)
示例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
示例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
示例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"
示例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
示例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
示例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
示例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
示例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
示例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
示例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)
示例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)