Пример #1
0
        public void PlaneInterpolationTest()
        {
            double[] lats = new double[] { 0.0, 5.0, 5.0 };
            double[] lons = new double[] { 0.0, 0.0, 6.0 };
            double[] vals = new double[] { 0.0, 3.0, 3.0 };


            FetchDomain  fd = FetchDomain.CreatePoints(new double[] { -5.0 }, new double[] { 6.0 }, new TimeRegion());
            FetchRequest fr = new FetchRequest("val", fd);

            var storage = new SimplePlaneStorageContext(lats, lons, vals, fr);

            storage.Request = fr;
            SpatialOnlyTpsDataHandler sotdh = new SpatialOnlyTpsDataHandler(storage);


            var compContext = new ComputationalContext();

            sotdh.EvaluateAsync(storage, compContext);
            var result = (double[])sotdh.AggregateAsync(storage, compContext).Result;

            Assert.AreEqual(-3.0, result[0], TestConstants.DoublePrecision);
        }
Пример #2
0
        public void SparsePointsYieldNansOrPlane()
        {
            double[] lats = new double[] { 0.0, 5.0, 50.0 };
            double[] lons = new double[] { 0.0, 0.0, 0.0 };
            double[] vals = new double[] { 1.0, 1.0, 1.0 };


            FetchDomain  fd = FetchDomain.CreatePoints(new double[] { 7.0 }, new double[] { 6.0 }, new TimeRegion());
            FetchRequest fr = new FetchRequest("val", fd);

            var storage = new SimplePlaneStorageContext(lats, lons, vals, fr);

            storage.Request = fr;
            SpatialOnlyTpsDataHandler sotdh = new SpatialOnlyTpsDataHandler(storage);

            ComputationalContext cc = new ComputationalContext();

            var unc = sotdh.EvaluateAsync(storage, cc).Result;

            var result = (double[])sotdh.AggregateAsync(storage, cc).Result;

            Assert.IsTrue(double.IsNaN(result[0]) || Math.Abs(1.0 - result[0]) < TestConstants.FloatPrecision);
        }