def calculate_rain_and_snow
      @snow_metar = 0
      @rain_metar = 0

      self.specials.each do |s|
        new_rain = 0
        new_snow = 0
        coefficient = 1
        case s[:precipitation]
          when 'drizzle' then
            new_rain = 5

          when 'rain' then
            new_rain = 10

          when 'snow' then
            new_snow = 10

          when 'snow grains' then
            new_snow = 5

          when 'ice crystals' then
            new_snow = 1
            new_rain = 1

          when 'ice pellets' then
            new_snow = 2
            new_rain = 2

          when 'hail' then
            new_snow = 3
            new_rain = 3

          when 'small hail/snow pellets' then
            new_snow = 1
            new_rain = 1
        end

        case s[:intensity]
          when 'in the vicinity' then
            coefficient = 1.5
          when 'heavy' then
            coefficient = 3
          when 'light' then
            coefficient = 0.5
          when 'moderate' then
            coefficient = 1
        end

        snow = new_snow * coefficient
        rain = new_rain * coefficient

        if @snow_metar < snow
          @snow_metar = snow
        end
        if @rain_metar < rain
          @rain_metar = rain
        end

      end

      # http://www.ofcm.gov/fmh-1/pdf/H-CH8.pdf page 3
      # 10 units means more than 0.3 (I assume 0.5) inch per hour, so:
      # 10 units => 0.5 * 25.4mm
      real_world_coefficient = 0.5 * 25.4 / 10.0

      @snow_metar *= real_world_coefficient
      @rain_metar *= real_world_coefficient
    end
def calculate_rain_and_snow
      @snow_metar = 0
      @rain_metar = 0

      self.specials.each do |s|
        new_rain = 0
        new_snow = 0
        coefficient = 1
        case s[:precipitation]
          when 'drizzle' then
            new_rain = 5

          when 'rain' then
            new_rain = 10

          when 'snow' then
            new_snow = 10

          when 'snow grains' then
            new_snow = 5

          when 'ice crystals' then
            new_snow = 1
            new_rain = 1

          when 'ice pellets' then
            new_snow = 2
            new_rain = 2

          when 'hail' then
            new_snow = 3
            new_rain = 3

          when 'small hail/snow pellets' then
            new_snow = 1
            new_rain = 1
        end

        case s[:intensity]
          when 'in the vicinity' then
            coefficient = 1.5
          when 'heavy' then
            coefficient = 3
          when 'light' then
            coefficient = 0.5
          when 'moderate' then
            coefficient = 1
        end

        snow = new_snow * coefficient
        rain = new_rain * coefficient

        if @snow_metar < snow
          @snow_metar = snow
        end
        if @rain_metar < rain
          @rain_metar = rain
        end

      end

      # http://www.ofcm.gov/fmh-1/pdf/H-CH8.pdf page 3
      # 10 units means more than 0.3 (I assume 0.5) inch per hour, so:
      # 10 units => 0.5 * 25.4mm
      real_world_coefficient = 0.5 * 25.4 / 10.0

      @snow_metar *= real_world_coefficient
      @rain_metar *= real_world_coefficient
    end
Calculate precipitation in self defined units and aproximated real world units