本文整理汇总了Python中metars.workers.decoders.default.MetarDecoderDefault类的典型用法代码示例。如果您正苦于以下问题:Python MetarDecoderDefault类的具体用法?Python MetarDecoderDefault怎么用?Python MetarDecoderDefault使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MetarDecoderDefault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_decode_dewpoint_negative
def test_decode_dewpoint_negative(self):
val = "M04"
decoder = MetarDecoderDefault()
decoder.decode_dewpoint(val)
res = decoder.decoded_metar["dewpoint"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "minus 4%sC" % degree_sign)
示例2: test_decode_temp
def test_decode_temp(self):
val = "10"
decoder = MetarDecoderDefault()
decoder.decode_temp(val)
res = decoder.decoded_metar["temp"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "10%sC" % degree_sign)
示例3: test_decode_rvr_with_variation
def test_decode_rvr_with_variation(self):
val = "R25R/2000V4000FT"
decoder = MetarDecoderDefault()
decoder.decode_rvr(val)
res = decoder.decoded_metar["rvr"][self.DECODED_KEY]
assert_equals(res, "variable, from 2,000 to 4,000 feet " \
"(runway 25R)")
示例4: test_decode_sea_level_pressure_less_49_point_9
def test_decode_sea_level_pressure_less_49_point_9(self):
# Edge case for SLP < 50 should have 1,000 hPa added
val = "SLP499"
decoder = MetarDecoderDefault()
decoder.decode_sea_level_pressure(val)
res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY]
assert_equals(res, "sea level pressure is 1,049.9 hPa")
示例5: test_decode_dewpoint_single_digit_degree_gets_leading_zero_stripped
def test_decode_dewpoint_single_digit_degree_gets_leading_zero_stripped(self):
val = "09"
decoder = MetarDecoderDefault()
decoder.decode_dewpoint(val)
res = decoder.decoded_metar["dewpoint"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "9%sC" % degree_sign)
示例6: test_decode_sea_level_pressure_is_50
def test_decode_sea_level_pressure_is_50(self):
# SLP >= 50 should have 900 hPa added
val = "SLP500"
decoder = MetarDecoderDefault()
decoder.decode_sea_level_pressure(val)
res = decoder.decoded_metar["sea_level_pressure"][self.DECODED_KEY]
assert_equals(res, "sea level pressure is 950.0 hPa")
示例7: test_decode_sky_condition_multiple_layers
def test_decode_sky_condition_multiple_layers(self):
val = ["SCT///", "FEW032", "OVC100TCU"]
decoder = MetarDecoderDefault()
decoder.decode_sky_condition(val)
res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
assert_equals(res, ["scattered clouds below reporting station elevation",
"few clouds at 3,200 feet",
"overcast at 10,000 feet (towering cumulus)"])
示例8: test_decode_wx_phenomena_tornado_waterspout_special_case
def test_decode_wx_phenomena_tornado_waterspout_special_case(self):
# +FC is a special case for tornadoes and waterspouts - the
# modifier '+' should be ignored.
val = ["+FC"]
decoder = MetarDecoderDefault()
decoder.decode_wx_phenomena(val)
res = decoder.decoded_metar["wx_phenomena"][self.DECODED_KEY]
assert_equals(res, ["funnel cloud (tornado or waterspout)"])
示例9: test_decoded_wind_variation_missing
def test_decoded_wind_variation_missing(self):
val = ""
decoder = MetarDecoderDefault()
decoder.decode_wind_dir_variation(val)
# The decoder should handle an empty wind variation, and the keys
# should exist in the decoded metar with empty values.
res = decoder.decoded_metar["wind_dir_variation"][self.DECODED_KEY]
assert_equals(res, "")
示例10: test_decode_obs_datetime
def test_decode_obs_datetime(self):
val = "290653Z"
decoder = MetarDecoderDefault()
decoder.decode_obs_datetime(val)
res_date = decoder.decoded_metar["obs_datetime"][self.DECODED_KEY]["date"]
res_time = decoder.decoded_metar["obs_datetime"][self.DECODED_KEY]["time"]
assert_equals(res_date, "29")
assert_equals(res_time, "0653")
示例11: test_decode_hourly_temp_dewpoint_both_neg_eleven_point_one
def test_decode_hourly_temp_dewpoint_both_neg_eleven_point_one(self):
val = "T11111111"
decoder = MetarDecoderDefault()
decoder.decode_hourly_temp_dewpoint(val)
res = decoder.decoded_metar["hourly_temp_dewpoint"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "hourly temperature is -11.1%sC, " \
"hourly dewpoint is -11.1%sC" % \
(degree_sign, degree_sign))
示例12: test_decode_hourly_temp_dewpoint_temp_pos_dewpoint_neg
def test_decode_hourly_temp_dewpoint_temp_pos_dewpoint_neg(self):
val = "T00801010"
decoder = MetarDecoderDefault()
decoder.decode_hourly_temp_dewpoint(val)
res = decoder.decoded_metar["hourly_temp_dewpoint"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "hourly temperature is 8.0%sC, " \
"hourly dewpoint is -1.0%sC" % \
(degree_sign, degree_sign))
示例13: test_decode_hourly_temp_dewpoint_temp_neg_dewpoint_pos
def test_decode_hourly_temp_dewpoint_temp_neg_dewpoint_pos(self):
val = "T10230012"
decoder = MetarDecoderDefault()
decoder.decode_hourly_temp_dewpoint(val)
res = decoder.decoded_metar["hourly_temp_dewpoint"][self.DECODED_KEY]
degree_sign = u'\N{DEGREE SIGN}'
assert_equals(res, "hourly temperature is -2.3%sC, " \
"hourly dewpoint is 1.2%sC" % \
(degree_sign, degree_sign))
示例14: test_decode_wx_phenomena_modifiers
def test_decode_wx_phenomena_modifiers(self):
decoder = MetarDecoderDefault()
# Light
val = ["-PY"]
decoder.decode_wx_phenomena(val)
res = decoder.decoded_metar["wx_phenomena"][self.DECODED_KEY]
assert_equals(res, ["light spray"])
# Moderate
val = ["PY"]
decoder.decode_wx_phenomena(val)
res = decoder.decoded_metar["wx_phenomena"][self.DECODED_KEY]
assert_equals(res, ["moderate spray"])
# Heavy
val = ["+PY"]
decoder.decode_wx_phenomena(val)
res = decoder.decoded_metar["wx_phenomena"][self.DECODED_KEY]
assert_equals(res, ["heavy spray"])
示例15: test_decode_hourly_temp_dewpoint_missing
def test_decode_hourly_temp_dewpoint_missing(self):
val = ""
decoder = MetarDecoderDefault()
decoder.decode_hourly_temp_dewpoint(val)
res = decoder.decoded_metar["hourly_temp_dewpoint"][self.DECODED_KEY]
assert_equals(res, "")