public void AggregateOneDimension()
        {
            //two dimensional function aggregation on x variable
            Function f = new Function();
            var x = new Variable<int>("x");
            var y = new Variable<int>("x");
            f.Arguments.Add(x);
            f.Arguments.Add(y);

            //step through x 0,5,10,...100..selecting 21 values from 0 to 100 ranging 101 values
            var xFilter = new VariableAggregationFilter(x, 5, 0, 100);

            FilteredArrayInfo info = new FilteredArrayInfo(f, new[] { xFilter });
            Assert.AreEqual(new[] { 0, -1 }, info.Origin);
            Assert.AreEqual(new[] { 21, -1 }, info.Shape);
            Assert.AreEqual(new[] { 101, -1 }, info.Size);
            Assert.AreEqual(new[] { 5, -1 }, info.Stride);
        }
        public void SelectTwoDimensional()
        {
            IFunction f = new Function();
            var x = new Variable<int>("x");
            var y = new Variable<int>("x");
            f.Arguments.Add(x);
            f.Arguments.Add(y);
            //step through x 0,5,10,...100..selecting 21 values from 0 to 100 ranging 101 values
            var xFilter = new VariableAggregationFilter(x, 5, 0, 100);
            //step through y 10,12,14..20..selecting 6 values from 10 to 20 ranging 11
            var yFilter = new VariableAggregationFilter(y, 2, 10, 20);

            FilteredArrayInfo info = new FilteredArrayInfo(f, new[] {xFilter, yFilter});
            Assert.AreEqual(new[] { 0, 10 }, info.Origin);
            Assert.AreEqual(new[] { 21, 6 }, info.Shape);
            Assert.AreEqual(new[] { 101, 11 }, info.Size);
            Assert.AreEqual(new[] { 5, 2 }, info.Stride);
        }
        public void SampleSize()
        {
            IVariable<int> x = new Variable<int>();

            int stepSize = 1;
            int startIndex = 0;
            int endIndex = 0;
            var filter = new VariableAggregationFilter(x, stepSize, startIndex, endIndex);
            Assert.AreEqual(1, filter.Count);

            stepSize = 2;
            startIndex = 0;
            endIndex = 3;
            filter = new VariableAggregationFilter(x, stepSize, startIndex, endIndex);
            Assert.AreEqual(2, filter.Count);


            stepSize = 2;
            startIndex = 0;
            endIndex = 4;
            filter = new VariableAggregationFilter(x, stepSize, startIndex, endIndex);
            Assert.AreEqual(3, filter.Count);
        }
        public void GetValuesWithAggregationFilter()
        {

            //  nRows 2566
            // nCols 1843
            // upper left corner of map
            // ULXMAP        124854.28
            // ULYMAP        523505.38
            // stepsize (m) for both dimensions
            // Xdim 20
            // Ydim 20

            string path = rasterDataPath + "Bodem.bil";

            var functionStore = new GdalFunctionStore { Path = path };
            functionStore.Open();
            //grid.GetValues()
            var grid = functionStore.Grid;

            //create filter for x and y to set xmin, xmax, ymin and ymax (VariableValueRangesFilter<>)
            var xFilter = new VariableAggregationFilter(grid.X,18,0,1782);
            var yFilter = new VariableAggregationFilter(grid.Y,25,0,2475);

            //get values between 130000-132000 and 526000-528000
            var values = grid.GetValues(xFilter, yFilter);

            //check count
            Assert.AreEqual(10000, values.Count);
        }