private static void ParseXForecast(XElement xForecast, List <AbstractParameter> parameters)
        {
            var xPhenomena = xForecast.Element("PHENOMENA");

            parameters.Add(Cloudiness.FromRange(
                               xPhenomena.Attribute("cloudiness").Value, maxClouds));
            parameters.Add(PrecipitationKind.FromGismeteoBased(
                               xPhenomena.Attribute("precipitation").Value));

            var xPres = xForecast.Element("PRESSURE");

            parameters.Add(new Pressure(
                               xPres.Attribute("max").Value));
            parameters.Add(new Pressure(
                               xPres.Attribute("min").Value));

            var xTemp = xForecast.Element("TEMPERATURE");

            parameters.Add(new Temperature(
                               xTemp.Attribute("max").Value));
            parameters.Add(new Temperature(
                               xTemp.Attribute("min").Value));

            var xWind = xForecast.Element("WIND");

            parameters.Add(WindDirection.FromRange(
                               xWind.Attribute("direction").Value, maxWindDir));
            parameters.Add(new WindSpeed(
                               xWind.Attribute("max").Value));
            parameters.Add(new WindSpeed(
                               xWind.Attribute("min").Value));

            var xHum = xForecast.Element("RELWET");

            parameters.Add(new Humidity(
                               xHum.Attribute("max").Value));
            parameters.Add(new Humidity(
                               xHum.Attribute("min").Value));
        }
Exemple #2
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));
            }
        }