/// <summary> /// Creates an instance of GribValuesIterator. /// </summary> /// <param name="h">The handle of the message to iterate.</param> /// <param name="filters">The filters.</param> /// <returns></returns> public static GribCoordinateValuesIterator Create(GribHandle h, uint filters) { int err = 0; GribCoordinateValuesIterator iter = GribApiProxy.GribIteratorNew(h, filters, out err); if (err != 0) { throw GribApiException.Create(err); } return(iter); }
///// <summary> ///// Find the nearest point of a set of points whose latitudes and longitudes. ///// </summary> ///// <param name="coordinates">The reference coordinates.</param> ///// <param name="useLandSeaMask">If true, the nearest land point is returned and the grib passed as the handle is considered a land sea mask. ///// land nearest point is the nearest point with land sea mask value>=0.5. If no nearest land points are found the nearest value is returned. ///// If the flag false, the nearest points, along with values, distances, and indexes are returned. ///// </param> ///// <returns></returns> //public GribNearestCoordinate[] FindNearestCoordinates(IGeoCoordinate[] coordinates, bool useLandSeaMask = false) //{ // var len = coordinates.Length; // var latitudes = new double[len]; // var longitudes = new double[len]; // var outLatitudes = new double[len]; // var outLongitudes = new double[len]; // var distances = new double[len]; // var values = new double[len]; // var indexes = new int[len]; // for (var i = 0; i < len; i++) // { // latitudes[i] = coordinates[i].Latitude; // longitudes[i] = coordinates[i].Longitude; // } // Interop.SizeT sz = (SizeT)len; // Interop.SWIG.GribApiProxy.GribNearestFindMultiple(this.Handle, useLandSeaMask ? 1 : 0, latitudes, longitudes, len, // outLatitudes, outLongitudes, values, distances, indexes); // var vals = new GribNearestCoordinate[len]; // for (var i = 0; i < len; i++) // { // vals[i] = new GribNearestCoordinate(latitudes[i], longitudes[i], values[i], distances[i], indexes[i]); // } // Array.Sort(vals, (v1, v2) => v1.Distance.CompareTo(v2.Distance)); // return vals; //} public static GribNearest Create(GribHandle handle) { int err = 0; var nearest = GribApiProxy.GribNearestNew(handle, out err); if (err != 0) { throw GribApiException.Create(err); } return(new GribNearest(nearest, handle)); }
/// <summary> /// Initializes a new instance of the <see cref="GribBox"/> class. /// </summary> /// <param name="msgHandle">The MSG handle.</param> /// <param name="nw">The nw.</param> /// <param name="se">The se.</param> public GribBox(GribHandle msgHandle, GridCoordinate nw, GridCoordinate se) { int err; var box = GribApiProxy.GribBoxNew(msgHandle, out err); if (err != 0) { throw GribApiException.Create(err); } var pts = GribApiProxy.GribBoxGetPoints(box, nw.Latitude, nw.Longitude, se.Latitude, se.Longitude, out err); if (err != 0) { throw GribApiException.Create(err); } _points = new GribPoints(SWIGTYPE_p_grib_points.getCPtr(pts).Handle, false); }