class SimpleMetarParser::Clouds
Constants
- CLOUD_BROKEN
Cloud level - broken
- CLOUD_CLEAR
Cloud level - clear sky
- CLOUD_FEW
Cloud level - few clouds
- CLOUD_NOT_SIGN
Cloud level - not significant
- CLOUD_OVERCAST
Cloud level - overcast
- CLOUD_SCATTERED
Cloud level - scattered
Attributes
clouds[R]
clouds_max[R]
Public Instance Methods
decode_split(s)
click to toggle source
# File lib/simple_metar_parser/metar/clouds.rb, line 26 def decode_split(s) if s =~ /^(SKC|FEW|SCT|BKN|OVC|NSC)(\d{3}?)$/ cl = case $1 when "SKC" then CLOUD_CLEAR when "FEW" then CLOUD_FEW when "SCT" then CLOUD_SCATTERED when "BKN" then CLOUD_BROKEN when "OVC" then CLOUD_OVERCAST when "NSC" then CLOUD_NOT_SIGN else CLOUD_CLEAR end cloud = { :coverage => cl } # optionally cloud bottom unless '' == $2.to_s cloud[:bottom] = $2.to_i * 30 end @clouds << cloud @clouds.uniq! end # obscured by clouds, vertical visibility if s =~ /^(VV)(\d{3}?)$/ @clouds << { :coverage => CLOUD_OVERCAST, :vertical_visibility => $2.to_i * 30 } @clouds.uniq! end if s =~ /^(CAVOK)$/ # everything is awesome :) end end
post_process()
click to toggle source
Calculate numeric description of clouds
# File lib/simple_metar_parser/metar/clouds.rb, line 74 def post_process @clouds_max = 0 @clouds.each do |c| @clouds_max = c[:coverage] if @clouds_max < c[:coverage] end end
reset()
click to toggle source
# File lib/simple_metar_parser/metar/clouds.rb, line 19 def reset @clouds = Array.new @clouds_max = nil end