public CoverageDimensionImpl(CoverageDimensionInfo other) { this.id = other.getId(); this.name = other.getName(); this.description = other.getDescription(); this.range = other.getRange(); this.nullValues = other.getNullValues(); this.unit = other.getUnit(); this.dimensionType = other.getDimensionType(); }
: sampleDimDescription; final List<Category> categories = sampleDim.getCategories(); NumberRange configuredRange = info.getRange(); final String uom = info.getUnit(); Unit defaultUnit = sampleDim.getUnits();
@Test public void testMultiBandCoverage() throws Exception { Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_BM.getLocalPart())); CoverageInfo ci = cb.buildCoverage(); // perform basic checks assertEquals(CRS.decode("EPSG:4326", true), ci.getCRS()); assertEquals("EPSG:4326", ci.getSRS()); assertNotNull(ci.getNativeCRS()); assertNotNull(ci.getNativeBoundingBox()); assertNotNull(ci.getLatLonBoundingBox()); // check the coverage dimensions List<CoverageDimensionInfo> dimensions = ci.getDimensions(); assertEquals(3, dimensions.size()); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("RED_BAND", dimension.getName()); assertEquals(0, dimension.getNullValues().size()); assertEquals(Double.NEGATIVE_INFINITY, dimension.getRange().getMinimum(), 0d); assertEquals(Double.POSITIVE_INFINITY, dimension.getRange().getMaximum(), 0d); assertEquals("W.m-2.Sr-1", dimension.getUnit()); }
@Test public void testSingleBandedCoverage() throws Exception { // build a feature type (it's already in the catalog, but we just want to // check it's built as expected // LINES is a feature type with a native SRS, so we want the bounds to be there Catalog cat = getCatalog(); CatalogBuilder cb = new CatalogBuilder(cat); cb.setStore(cat.getCoverageStoreByName(MockData.TASMANIA_DEM.getLocalPart())); CoverageInfo ci = cb.buildCoverage(); // perform basic checks assertEquals(CRS.decode("EPSG:4326", true), ci.getCRS()); assertEquals("EPSG:4326", ci.getSRS()); assertNotNull(ci.getNativeCRS()); assertNotNull(ci.getNativeBoundingBox()); assertNotNull(ci.getLatLonBoundingBox()); // check the coverage dimensions List<CoverageDimensionInfo> dimensions = ci.getDimensions(); assertEquals(1, dimensions.size()); CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("GRAY_INDEX", dimension.getName()); assertEquals(1, dimension.getNullValues().size()); assertEquals(-9999, dimension.getNullValues().get(0), 0d); assertEquals(Double.NEGATIVE_INFINITY, dimension.getRange().getMinimum(), 0d); // Huston, we have a problem here... // assertEquals(9999, dimension.getRange().getMaximum(), 0d); assertNull(dimension.getUnit()); }
if (meta.getDimensions() != null) { for (CoverageDimensionInfo dimension : meta.getDimensions()) { int size = guessSizeFromRange(dimension.getRange()); if (size == 0) { LOGGER.log(
/** * Given a set of sample dimensions, this will return a valid range only if all sample * dimensions have one, otherwise null * * @param dimensions */ protected NumberRange getCoverageRange(List<CoverageDimensionInfo> dimensions) { NumberRange range = null; for (CoverageDimensionInfo dimension : dimensions) { if (dimension.getRange() == null) return null; else if (range == null) range = dimension.getRange(); else range.union(dimension.getRange()); } return range; }
/** * Tries to encode a meaningful range for a {@link SampleDimension}. * * @param sd the {@link CoverageDimensionInfo} to encode a meaningful range for. */ public void handleSampleDimensionRange(CoverageDimensionInfo sd) { if (!setRange(sd.getRange())) { SampleDimensionType sdType = sd.getDimensionType(); handleSampleDimensionType(sdType); } }
CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("RED_BAND", dimension.getName()); NumberRange range = dimension.getRange(); assertEquals(Double.NEGATIVE_INFINITY, range.getMinimum(), DELTA); assertEquals(Double.POSITIVE_INFINITY, range.getMaximum(), DELTA);
CoverageDimensionInfo dimension = dimensions.get(0); assertEquals("GRAY_INDEX", dimension.getName()); NumberRange range = dimension.getRange(); assertEquals(Double.NEGATIVE_INFINITY, range.getMinimum(), DELTA); assertEquals(Double.POSITIVE_INFINITY, range.getMaximum(), DELTA); dimension = dimensions.get(0); assertEquals("Elevation", dimension.getName()); range = dimension.getRange(); assertEquals(-100.0, range.getMinimum(), DELTA); assertEquals(1000.0, range.getMaximum(), DELTA);