@Test public void testFloatingPointCompare() throws Exception { String spec = TestDir.cdmUnitTestDir+"ft/fmrc/fp_precision/sediment_thickness_#yyMMddHHmm#.*\\.nc$"; System.out.printf("%n====================FMRC dataset %s%n", spec); Formatter errlog = new Formatter(); Fmrc fmrc = Fmrc.open(spec, errlog); assert (fmrc != null) : errlog; try (ucar.nc2.dt.GridDataset gridDs = fmrc.getDatasetBest()) { GridDatatype v = gridDs.findGridByShortName("thickness_of_sediment"); assert v != null; GridCoordSystem gcs = v.getCoordinateSystem(); CoordinateAxis1DTime time = gcs.getTimeAxis1D(); Assert.assertEquals("hours since 2015-03-08 12:51:00.000 UTC", time.getUnitsString()); Assert.assertEquals(74, time.getSize()); Array data = time.read(); logger.debug("{}", NCdumpW.toString(data)); for (CalendarDate cd : time.getCalendarDates()) { assert cd.getFieldValue(CalendarPeriod.Field.Minute) == 0 : System.out.printf("%s%n", cd); } } } }
double[] want = new double[]{0., 12., 24., 36.}; CompareNetcdf2 cn = new CompareNetcdf2(); assert cn.compareData("reftime", reftime.read(), Array.makeFromJavaArray(want), false);
double[] runtimeValues = new double[]{0.}; CompareNetcdf2 cn = new CompareNetcdf2(); assert cn.compareData("reftime", reftime.read(), Array.makeFromJavaArray(runtimeValues), false);