當前位置: 首頁>>代碼示例>>Python>>正文


Python default.MetarDecoderDefault類代碼示例

本文整理匯總了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)
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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)
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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)")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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)
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:7,代碼來源:metar_decoder_tests.py

示例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)"])
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:8,代碼來源:metar_decoder_tests.py

示例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)"])
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:8,代碼來源:metar_decoder_tests.py

示例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, "")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:8,代碼來源:metar_decoder_tests.py

示例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")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:8,代碼來源:metar_decoder_tests.py

示例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))
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:9,代碼來源:metar_decoder_tests.py

示例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))
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:9,代碼來源:metar_decoder_tests.py

示例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))
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:9,代碼來源:metar_decoder_tests.py

示例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"])
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:17,代碼來源:metar_decoder_tests.py

示例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, "")
開發者ID:peterussell,項目名稱:wxdecoder.com,代碼行數:6,代碼來源:metar_decoder_tests.py


注:本文中的metars.workers.decoders.default.MetarDecoderDefault類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。