Example #1
0
 public static IEnumerable <Wind> Generate(IWindTableCollection windTables,
                                           double lat, double lon, IEnumerable <double> flightLevels)
 {
     return(flightLevels.Select(fl =>
     {
         var UVWind = windTables.GetWindUV(lat, lon, fl * 100.0);
         return Wind.FromUV(UVWind);
     }));
 }
        /// <summary>
        /// Gets the wind vector in earth's coordinate at the given location.
        /// </summary>
        public static Vector3D GetWind(
            IWindTableCollection windData,
            double altitudeFt,
            double lat,
            double lon)
        {
            var w = windData.GetWindUV(lat, lon, altitudeFt);

            lat = ToRadian(lat);
            lon = ToRadian(lon);

            double sinLat = Sin(lat);
            double sinLon = Sin(lon);
            double cosLon = Cos(lon);

            var u1 = new Vector3D(-sinLon, cosLon, 0.0);
            var u2 = new Vector3D(-sinLat * cosLon, -sinLat * sinLon, Cos(lat));

            return(u1 * w.UComp + u2 * w.VComp);
        }