• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python default.MetarDecoderDefault类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: test_decode_altimeter

 def test_decode_altimeter(self):
   val = "2992"
   decoder = MetarDecoderDefault()
   decoder.decode_altimeter(val)
   res = decoder.decoded_metar["altimeter"][self.DECODED_KEY]
   assert_equals(res, "29.92\"Hg")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests.py


示例17: test_decode_wind_single_knot_speed_isnt_pluralized

 def test_decode_wind_single_knot_speed_isnt_pluralized(self):
   val = "02001KT"
   decoder = MetarDecoderDefault()
   decoder.decode_wind_dir_speed(val)
   res = decoder.decoded_metar["wind_dir_speed"][self.DECODED_KEY]
   assert_equals(res, "from 020 degrees, at 1 knot")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests.py


示例18: test_decode_wind_dir_speed_with_gusts

 def test_decode_wind_dir_speed_with_gusts(self):
   val = "18014G18KT"
   decoder = MetarDecoderDefault()
   decoder.decode_wind_dir_speed(val)
   res = decoder.decoded_metar["wind_dir_speed"][self.DECODED_KEY]
   assert_equals(res, "from 180 degrees, at 14 knots gusting to 18 knots")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests.py


示例19: test_decode_temp_missing

 def test_decode_temp_missing(self):
   val = ""
   decoder = MetarDecoderDefault()
   decoder.decode_temp(val)
   res = decoder.decoded_metar["temp"][self.DECODED_KEY]
   assert_equals(res, "(missing)")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests.py


示例20: test_decode_sea_level_pressure_less_than_50

 def test_decode_sea_level_pressure_less_than_50(self):
   val = "SLP196"
   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,019.6 hPa")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python nz.MetarDecoderNZ类代码示例发布时间:2022-05-27
下一篇:
Python parser.Parser类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap