public CoverageAsPoint(CoverageCollection gcd, List<String> varNames, SubsetParams subset) throws IOException { this.gcd = gcd; this.subset = subset; latLonPoint = (LatLonPointImpl) subset.get(SubsetParams.latlonPoint); if (latLonPoint == null) throw new IllegalArgumentException("No latlon point"); varData = new ArrayList<>(varNames.size()); for (String varName : varNames) { Coverage cov = gcd.findCoverage(varName); // LOOK we should read all at once if possible if (cov != null) { varData.add(new VarData(cov)); if (dateUnit == null) { // assume all have the same time unit, just use the first one CoverageCoordSys csys = cov.getCoordSys(); CoverageCoordAxis timeAxis = csys.getTimeAxis(); this.dateUnit = timeAxis.getCalendarDateUnit(); } } } }
TimeseriesIterator() { varIters = new ArrayList<>(); for (VarData vd : varData) { Array data = vd.array.getData(); if (debug) System.out.printf("%s shape=%s%n", vd.cov.getName(), Misc.showInts(data.getShape())); varIters.add(new VarIter(vd.cov, vd.array, data.getIndexIterator())); nvalues = (int) data.getSize(); if (timeAxis == null) { // assume they are all the same (!) CoverageCoordSys csys = vd.array.getCoordSysForData(); timeAxis = (CoverageCoordAxis1D) csys.getTimeAxis(); // LOOK may not be right } } }
@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()); } } } }
CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull("time axis", time); double[] expect = new double[]{0., 6.0, 12.0, 18.0};
assert null == gcs.getZAxis(); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull("time axis", time); Assert.assertEquals(12, time.getNcoords());
assert cn.compareData("time", reftime.getCoordsAsArray(), Array.makeFromJavaArray(want), false); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull(time); Assert.assertTrue(time instanceof TimeAxis2DFmrc);
assert null == gcs.getZAxis(); CoverageCoordAxis time = gcs.getTimeAxis(); assert time != null; Assert.assertNotNull("time axis", time);
assert cn.compareData("time", reftime.getCoordsAsArray(), Array.makeFromJavaArray(want), false); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull(time); Assert.assertTrue(time instanceof TimeAxis2DFmrc);
assert cn.compareData("time", reftime.getCoordsAsArray(), Array.makeFromJavaArray(runtimeValues), false); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull(time); Assert.assertEquals(4, time.getNcoords());
Assert.assertNull(gcs.getZAxis()); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull(time); Assert.assertNotNull("time axis", time);
Assert.assertArrayEquals(expectShape, grid.getShape()); CoverageCoordAxis time = gcs.getTimeAxis(); Assert.assertNotNull("time axis", time); Assert.assertEquals(2, time.getNcoords());