if (axis.getDependenceType() == CoverageCoordAxis.DependenceType.dependent) continue; if (axis.getAxisType().isHoriz()) continue; if (isTime2D(axis)) continue;
@Ignore("files not present") @Test public void testGridCoverageDatasetFmrc() throws IOException, InvalidRangeException { System.out.printf("%s%n", filename); try (FeatureDatasetCoverage fdc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, fdc); CoverageCollection cc = fdc.findCoverageDataset(FeatureType.GRID); Assert.assertNotNull(FeatureType.GRID.toString(), cc); System.out.printf(" %s type=%s%n", cc.getName(), cc.getCoverageType()); for (CoverageCoordSys coordSys : cc.getCoordSys()) { Assert.assertTrue( coordSys.isTime2D(coordSys.getAxis(AxisType.RunTime))); Assert.assertTrue( coordSys.isTime2D(coordSys.getTimeAxis())); } for (CoverageCoordAxis axis : cc.getCoordAxes()) { if (axis.getAxisType().isTime()) System.out.printf(" %12s %10s %5d %10s %s%n", axis.getName(), axis.getAxisType(), axis.getNcoords(), axis.getDependenceType(), axis.getSpacing()); } } } }
@Test public void testBestTimeCoordinates() throws IOException { String filename = TestDir.cdmUnitTestDir + "ncss/GFS/CONUS_80km/GFS_CONUS_80km.ncx4"; String gridName = "Pressure_surface"; try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, cc); Assert.assertEquals(2, cc.getCoverageCollections().size()); CoverageCollection cd = cc.findCoverageDataset(FeatureType.GRID); Assert.assertNotNull(FeatureType.GRID.toString(), cd); Coverage cov = cd.findCoverage(gridName); Assert.assertNotNull(gridName, cov); CoverageCoordSys csys = cov.getCoordSys(); Assert.assertNotNull("CoverageCoordSys", csys); CoverageCoordAxis time = csys.getAxis(AxisType.Time); Assert.assertNotNull(AxisType.Time.toString(), time); Assert.assertTrue(time.getClass().getName(), time instanceof CoverageCoordAxis1D); Assert.assertEquals(CoverageCoordAxis.Spacing.irregularPoint, time.getSpacing()); Assert.assertEquals(CoverageCoordAxis.DependenceType.independent, time.getDependenceType()); Assert.assertEquals(CalendarDate.parseISOformat(null, "2012-02-27T00:00:00Z"), time.makeDate(0)); Assert2.assertNearlyEquals(6.0, time.getResolution()); Assert.assertEquals(false, csys.isTime2D(time)); CoverageCoordAxis runtime = csys.getAxis(AxisType.RunTime); Assert.assertNotNull(AxisType.RunTime.toString(), runtime); Assert.assertTrue(runtime.getClass().getName(), runtime instanceof CoverageCoordAxis1D); Assert.assertEquals(CoverageCoordAxis.Spacing.irregularPoint, runtime.getSpacing()); Assert.assertEquals(CoverageCoordAxis.DependenceType.dependent, runtime.getDependenceType()); Assert.assertEquals(CalendarDate.parseISOformat(null, "2012-02-27T00:00:00Z"), runtime.makeDate(0)); } }
@Test public void test2DTimeCoordinates() throws IOException { String filename = TestDir.cdmUnitTestDir + "ncss/GFS/CONUS_80km/GFS_CONUS_80km.ncx4"; String gridName = "Pressure_surface"; try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(filename)) { Assert.assertNotNull(filename, cc); Assert.assertEquals(2, cc.getCoverageCollections().size()); CoverageCollection cd = cc.findCoverageDataset(FeatureType.FMRC); Assert.assertNotNull(FeatureType.FMRC.toString(), cd); Coverage cov = cd.findCoverage(gridName); Assert.assertNotNull(gridName, cov); CoverageCoordSys csys = cov.getCoordSys(); Assert.assertNotNull("CoverageCoordSys", csys); CoverageCoordAxis runtime = csys.getAxis(AxisType.RunTime); Assert.assertNotNull(AxisType.RunTime.toString(), runtime); Assert.assertTrue(runtime.getClass().getName(), runtime instanceof CoverageCoordAxis1D); Assert.assertEquals(CoverageCoordAxis.Spacing.irregularPoint, runtime.getSpacing()); Assert.assertEquals(CoverageCoordAxis.DependenceType.independent, runtime.getDependenceType()); Assert.assertEquals(CalendarDate.parseISOformat(null, "2012-02-27T00:00:00Z"), runtime.makeDate(0)); Assert2.assertNearlyEquals(6.0, runtime.getResolution()); CoverageCoordAxis time = csys.getAxis(AxisType.TimeOffset); Assert.assertNotNull(AxisType.TimeOffset.toString(), time); Assert.assertTrue(time.getClass().getName(), time instanceof TimeOffsetAxis); Assert.assertEquals(CoverageCoordAxis.Spacing.irregularPoint, time.getSpacing()); Assert.assertEquals(CoverageCoordAxis.DependenceType.independent, time.getDependenceType()); Assert.assertEquals(CalendarDate.parseISOformat(null, "2012-02-27T00:00:00Z"), time.makeDate(0)); Assert2.assertNearlyEquals(6.0, time.getResolution()); Assert.assertEquals(true, csys.isTime2D(time)); } }