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

Python nz.MetarDecoderNZ类代码示例

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

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



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

示例1: test_decode_temp

 def test_decode_temp(self):
   val = "10"
   decoder = MetarDecoderNZ()
   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_nz.py


示例2: test_decode_dewpoint_negative

 def test_decode_dewpoint_negative(self):
   val = "M04"
   decoder = MetarDecoderNZ()
   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_nz.py


示例3: 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 = MetarDecoderNZ()
   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_nz.py


示例4: test_decode_nzch_metar

 def test_decode_nzch_metar(self):
   # Basic smoke test to make sure the code gets run through and parser
   # works, without asserting any results.
   with open('metars/workers/tests/data/nzch-encoded.json') as data:
     nzch = json.load(data)
   decoder = MetarDecoderNZ()
   decoder.decode_metar(nzch["metar"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:7,代码来源:metar_decoder_tests_nz.py


示例5: 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 = MetarDecoderNZ()
   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_nz.py


示例6: test_decode_obs_datetime

 def test_decode_obs_datetime(self):
   val = "301900Z"
   decoder = MetarDecoderNZ()
   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, "30")
   assert_equals(res_time, "1900")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:8,代码来源:metar_decoder_tests_nz.py


示例7: test_decoded_wind_variation_missing

 def test_decoded_wind_variation_missing(self):
   val = ""
   decoder = MetarDecoderNZ()
   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_nz.py


示例8: test_decode_sky_condition_multiple_layers

 def test_decode_sky_condition_multiple_layers(self):
   val = ["SCT016///", "BKN085///", "OVC100TCU"]
   decoder = MetarDecoderNZ()
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["scattered clouds at 1,600 feet (no cloud type)",
                       "broken clouds at 8,500 feet (no cloud type)",
                       "overcast at 10,000 feet (towering cumulus)"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:8,代码来源:metar_decoder_tests_nz.py


示例9: test_decode_wx_phenomena_modifiers

 def test_decode_wx_phenomena_modifiers(self):
   decoder = MetarDecoderNZ()
   # 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_nz.py


示例10: test_decode_sky_condition_no_cloud_detected_nzaa_nzwn_nzch

 def test_decode_sky_condition_no_cloud_detected_nzaa_nzwn_nzch(self):
   val = ["NCD"]
   decoder = MetarDecoderNZ()
   # NZAA
   decoder.decoded_metar["icao_id"][self.DECODED_KEY] = "NZAA"
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["no cloud detected below 10,000 feet"])
   # NZAA
   decoder.decoded_metar["icao_id"][self.DECODED_KEY] = "NZWN"
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["no cloud detected below 10,000 feet"])
   # NZAA
   decoder.decoded_metar["icao_id"][self.DECODED_KEY] = "NZCH"
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["no cloud detected below 10,000 feet"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:18,代码来源:metar_decoder_tests_nz.py


示例11: test_decode_sky_condition_basic

 def test_decode_sky_condition_basic(self):
   val = ["FEW020"]
   decoder = MetarDecoderNZ()
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["few clouds at 2,000 feet"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例12: test_decode_dewpoint_missing

 def test_decode_dewpoint_missing(self):
   val = ""
   decoder = MetarDecoderNZ()
   decoder.decode_dewpoint(val)
   res = decoder.decoded_metar["dewpoint"][self.DECODED_KEY]
   assert_equals(res, "(missing)")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例13: test_decode_icao_id

 def test_decode_icao_id(self):
   val = "NZCH"
   decoder = MetarDecoderNZ()
   decoder.decode_icao_id(val)
   res = decoder.decoded_metar["icao_id"][self.DECODED_KEY]
   assert_equals(res, "NZCH")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例14: test_decode_sky_condition_sky_clear

 def test_decode_sky_condition_sky_clear(self):
   val = ["SKC"]
   decoder = MetarDecoderNZ()
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["sky clear"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例15: test_decode_is_not_special_report

 def test_decode_is_not_special_report(self):
   val = False
   decoder = MetarDecoderNZ()
   decoder.decode_is_special_report(val)
   res = decoder.decoded_metar["is_special_report"][self.DECODED_KEY]
   assert_equals(res, False)
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例16: test_decode_wind_single_knot_speed_isnt_pluralized

 def test_decode_wind_single_knot_speed_isnt_pluralized(self):
   val = "02001KT"
   decoder = MetarDecoderNZ()
   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_nz.py


示例17: test_decode_wind_dir_speed_with_gusts

 def test_decode_wind_dir_speed_with_gusts(self):
   val = "03019G29KT"
   decoder = MetarDecoderNZ()
   decoder.decode_wind_dir_speed(val)
   res = decoder.decoded_metar["wind_dir_speed"][self.DECODED_KEY]
   assert_equals(res, "from 030 degrees, at 19 knots gusting to 29 knots")
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例18: test_decode_is_not_automated

 def test_decode_is_not_automated(self):
   val = False
   decoder = MetarDecoderNZ()
   decoder.decode_mod_auto(val)
   res = decoder.decoded_metar["mod_auto"][self.DECODED_KEY]
   assert_equals(res, False)
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例19: test_decode_sky_condition_sensor_inop

 def test_decode_sky_condition_sensor_inop(self):
   val = ["VV///"]
   decoder = MetarDecoderNZ()
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["vertical visibility unavailable"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py


示例20: test_decode_sky_condition_sky_clear_automated

 def test_decode_sky_condition_sky_clear_automated(self):
   val = ["CLR"]
   decoder = MetarDecoderNZ()
   decoder.decode_sky_condition(val)
   res = decoder.decoded_metar["sky_condition"][self.DECODED_KEY]
   assert_equals(res, ["no clouds below 12,000 feet"])
开发者ID:peterussell,项目名称:wxdecoder.com,代码行数:6,代码来源:metar_decoder_tests_nz.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python models.TogetherManager类代码示例发布时间:2022-05-27
下一篇:
Python default.MetarDecoderDefault类代码示例发布时间: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