@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); List<Integer> offsets = getOffsetSorted(); for (int i = 0; i < offsets.size() - 1; i++) { int diff = offsets.get(i + 1) - offsets.get(i); counters.count("resol", diff); } return counters; }
public String toString() { Formatter f = new Formatter(); show(f); return f.toString(); }
@Test public void readGrib1Files() throws Exception { counterCurrent = countersAll.makeSubCounters(); int fail = readAllDir(TestDir.cdmUnitTestDir + "formats/grib1", null, false); logger.debug("readGrib1Files = {}", counterCurrent); countersAll.addTo(counterCurrent); Assert.assertEquals(0, fail); }
public int readGridDataset() throws IOException { kind = KIND_GRID; int countFailures = 0; try (GridDataset gds = GridDataset.open(filename)) { NetcdfFile ncfile = gds.getNetcdfFile(); IOServiceProvider iosp = ncfile.getIosp(); isGrib1 = iosp instanceof Grib1Iosp; for (GridDatatype gdt : gds.getGrids()) { if (read(gdt)) counters.count(kind, "success"); else { counters.count(kind, "fail"); countFailures++; } } } return countFailures; }
@Test public void doOneFile() throws IOException { System.out.printf("%s%n", endpoint); ucar.nc2.util.Counters fileCounters = GribCoordsMatchGbx.getCounters(); GribCoordsMatchGbx helper = new GribCoordsMatchGbx(endpoint, fileCounters); int fail = helper.readGridDataset(); fail += helper.readCoverageDataset(); if (showFileCounters) System.out.printf("fileCounters= %s%n", fileCounters); countersAll.addTo(fileCounters); Assert.assertEquals(0, fail); }
@Test public void readGrib2Files() throws Exception { counterCurrent = countersAll.makeSubCounters(); int fail = readAllDir(TestDir.cdmUnitTestDir + "formats/grib2", null, false); logger.debug("readGrib2Files = {}", counterCurrent); countersAll.addTo(counterCurrent); Assert.assertEquals(0, fail); }
public int readCoverageDataset() throws IOException { kind = KIND_COVERAGE; int countFailures = 0; try (FeatureDatasetCoverage fdc = CoverageDatasetFactory.open(filename)) { Attribute att = fdc.findGlobalAttributeIgnoreCase("file_format"); isGrib1 = att.getStringValue().equalsIgnoreCase("GRIB-1"); for (CoverageCollection cc : fdc.getCoverageCollections()) { for (Coverage cover : cc.getCoverages()) { if (readCoverage(cover)) counters.count(kind, "success"); else { counters.count(kind, "fail"); countFailures++; } } } } return countFailures; }
@Test public void doOneFile() throws IOException { System.out.printf("%s%n", endpoint); ucar.nc2.util.Counters fileCounters = GribCoordsMatchGbx.getCounters(); GribCoordsMatchGbx helper = new GribCoordsMatchGbx(endpoint, fileCounters); int fail = helper.readGridDataset(); fail += helper.readCoverageDataset(); if (showFileCounters) System.out.printf("fileCounters= %s%n", fileCounters); countersAll.addTo(fileCounters); Assert.assertEquals(0, fail); } }
@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); List<Double> offsets = getOffsetsInTimeUnits(); for (int i = 0; i < offsets.size() - 1; i++) { Double diff = offsets.get(i + 1) - offsets.get(i); counters.count("resol", diff); } return counters; }
@Test public void readNcepFiles() throws Exception { counterCurrent = countersAll.makeSubCounters(); int fail = readAllDir(TestDir.cdmUnitTestDir + "tds/ncep", null, true); logger.debug("readNcepFiles = {}", counterCurrent); countersAll.addTo(counterCurrent); Assert.assertEquals(0, fail); }
@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); for (int i = 0; i < ensSorted.size() - 1; i++) { int diff = ensSorted.get(i + 1).getEnsMember() - ensSorted.get(i).getEnsMember(); counters.count("resol", diff); } return counters; }
@Test public void readFnmocFiles() throws Exception { counterCurrent = countersAll.makeSubCounters(); int fail = readAllDir(TestDir.cdmUnitTestDir + "tds/fnmoc", null, true); logger.debug("readFnmocFiles = {}", counterCurrent); countersAll.addTo(counterCurrent); Assert.assertEquals(0, fail); }
@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); counters.add("intv"); List<TimeCoord.Tinv> offsets = getTimeIntervals(); for (int i = 0; i < offsets.size(); i++) { int intv = offsets.get(i).getBounds2() - offsets.get(i).getBounds1(); counters.count("intv", intv); if (i < offsets.size() - 1) { int resol = offsets.get(i + 1).getBounds1() - offsets.get(i).getBounds1(); counters.count("resol", resol); } } return counters; }
@Override public int doAct(String filename) throws IOException { Path filePath = Paths.get(filename); String fileName = filePath.getFileName().toString(); int fail =0; int fail2 = 0; if (!(skipFileGrib1.contains(fileName) || skipFileGrib2.contains(fileName))) { ucar.nc2.util.Counters fileCounters = counterCurrent.makeSubCounters(); GribCoordsMatchGbx helper = new GribCoordsMatchGbx(filename, fileCounters); fail = helper.readGridDataset(); fail2 = helper.readCoverageDataset(); if (showFileCounters) logger.debug("fileCounters= {}", fileCounters); counterCurrent.addTo(fileCounters); } else { logger.warn("Skipping file {}", filename); } return fail + fail2; }
@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); if (isLayer) { counters.add("intv"); for (int i = 0; i < levelSorted.size(); i++) { double intv = (levelSorted.get(i)).getValue2() - (levelSorted.get(i)).getValue1(); counters.count("intv", intv); if (i < levelSorted.size() - 1) { double resol = (levelSorted.get(i + 1)).getValue1() - (levelSorted.get(i)).getValue1(); counters.count("resol", resol); } } } else { for (int i = 0; i < levelSorted.size() - 1; i++) { double diff = levelSorted.get(i + 1).getValue1() - levelSorted.get(i).getValue1(); counters.count("resol", diff); } } return counters; }
@Override public Counters calcDistributions() { ucar.nc2.util.Counters counters = new Counters(); counters.add("resol"); List<? extends Object> offsets = getOffsetsSorted(); if (isTimeInterval()) { counters.add("intv"); for (int i = 0; i < offsets.size(); i++) { TimeCoord.Tinv tinv = (TimeCoord.Tinv) offsets.get(i); int intv = tinv.getBounds2() - tinv.getBounds1(); counters.count("intv", intv); if (i > 0) { int resol = tinv.getBounds1() - ((TimeCoord.Tinv)offsets.get(i-1)).getBounds1(); counters.count("resol", resol); } } } else { for (int i = 0; i < offsets.size() - 1; i++) { int diff = (Integer) offsets.get(i + 1) - (Integer) offsets.get(i); counters.count("resol", diff); } } return counters; }