Package org.geoserver.catalog.CoverageDimensionCustomizerReader

Examples of org.geoserver.catalog.CoverageDimensionCustomizerReader.WrappedSampleDimension


        final double noData2 = -32767d;
        nullValues.add(noData1);
        nullValues.add(noData2);
        coverageDim.setNullValues(nullValues);

        final SampleDimension wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);
        double[] noData = wrappedDim.getNoDataValues();

        assertEquals(2, noData.length);
        assertEquals(noData1, noData[0], DELTA);
        assertEquals(noData2, noData[1], DELTA);

        NumberRange wrappedRange = ((WrappedSampleDimension)wrappedDim).getRange();
        assertEquals(newMinimum, wrappedRange.getMinimum(), DELTA);
        assertEquals(newMaximum, wrappedRange.getMaximum(), DELTA);

        assertEquals(wrappedName, wrappedDim.getDescription().toString());
    }
View Full Code Here


                new Category[] { new Category(
                        Vocabulary.formatInternational(VocabularyKeys.NODATA),
                        new Color(0, 0, 0, 0), 0) }, null);

        // Wrap the dimension
        GridSampleDimension wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);

        // Ensure nodata are correct
        double[] noData = wrappedDim.getNoDataValues();
        assertEquals(2, noData.length);
        assertEquals(noData1, noData[0], DELTA);
        assertEquals(noData2, noData[1], DELTA);

        // Extract categories
        List<Category> categories = wrappedDim.getCategories();

        // Ensure NoData Category is present
        Category category = categories.get(0);
        assertTrue(category.getName().equals(Category.NODATA.getName()));

        // Check that it does not contain sampleToGeophisics and that the Range contains only NaN
        assertNull(category.getSampleToGeophysics());
        assertEquals(category.geophysics(true).getRange().getMinimum(), Double.NaN, DELTA);
        assertEquals(category.geophysics(true).getRange().getMaximum(), Double.NaN, DELTA);

        // Quantitative nodata category
        sampleDim = new GridSampleDimension("original", new Category[] { new Category(
                Vocabulary.formatInternational(VocabularyKeys.NODATA), new Color[] { new Color(0,
                        0, 0, 0) }, NumberRange.create(-9999, -9999), NumberRange.create(-9999,
                        -9999)) }, null);

        // Wrap the dimension
        wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);

        // Ensure nodata are correct
        noData = wrappedDim.getNoDataValues();
        assertEquals(2, noData.length);
        assertEquals(noData1, noData[0], DELTA);
        assertEquals(noData2, noData[1], DELTA);

        // Extract categories
        categories = wrappedDim.getCategories();

        // Ensure NoData Category is present
        category = categories.get(0);
        assertTrue(category.getName().equals(Category.NODATA.getName()));
View Full Code Here

        final CoverageDimensionImpl coverageDim = new CoverageDimensionImpl();
        final String wrappedName = "wrapped";
        coverageDim.setName(wrappedName);
        coverageDim.setDimensionType(SampleDimensionType.REAL_64BITS);
        // Creation of the WrappedSampleDimension
        SampleDimension wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);
        // Get the range
        NumberRange<? extends Number> wrappedRange = ((WrappedSampleDimension) wrappedDim)
                .getRange();
        // Ensure the range is not present
        assertNull(wrappedRange);
        // Check if min and max are taken from the categories
        assertEquals(-9999, wrappedDim.getMinimumValue(), DELTA);
        assertEquals(1000, wrappedDim.getMaximumValue(), DELTA);
        // Check that the description is equal to the sample dimension name
        assertEquals(wrappedName, wrappedDim.getDescription().toString());

        // Configure a new GridSampleDimension without categories
        sampleDim = new GridSampleDimension("original", null, new BaseUnit<Quantity>("test"));
        // New wrapped sample dimension
        wrappedDim = new WrappedSampleDimension(sampleDim, coverageDim);
        // Get the range
        wrappedRange = ((WrappedSampleDimension) wrappedDim).getRange();
        // Ensure the range is not present
        assertNull(wrappedRange);
        // Check if min and max are taken from the categories
        assertEquals(Double.NEGATIVE_INFINITY, wrappedDim.getMinimumValue(), DELTA);
        assertEquals(Double.POSITIVE_INFINITY, wrappedDim.getMaximumValue(), DELTA);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.catalog.CoverageDimensionCustomizerReader.WrappedSampleDimension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.