Ejemplo n.º 1
0
        private static void ParseXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            var temp = Temperature.FromDouble(
                xForecast.Element("temp_c").Value);

            parameters.Add(temp);

            parameters.Add(WindSpeed.FromKnot(
                               xForecast.Element("wind_speed_kt").Value));

            parameters.Add(new WindDirection(
                               xForecast.Element("wind_dir_degrees").Value));

            var skyDescription = ParseXSky(xForecast);

            parameters.Add(Cloudiness.FromMetarReportInFt(
                               skyDescription));

            parameters.Add(Pressure.FromInhg(
                               xForecast.Element("altim_in_hg").Value));

            var duePoint = Temperature.FromDouble(
                xForecast.Element("dewpoint_c").Value);

            parameters.Add(Humidity.FromDewPoint(temp, duePoint));

            var xWx = xForecast.Element("wx_string");

            if (xWx != null)
            {
                parameters.Add(PrecipitationKind.FromMetar(
                                   xWx.Value));
            }
            else
            {
                parameters.Add(new PrecipitationKind(0));
            }
        }