From 8fab7bf1a164716d67a0a1d68116e80073c0207e Mon Sep 17 00:00:00 2001 From: Tara Drwenski Date: Tue, 5 Mar 2024 14:10:29 -0700 Subject: [PATCH] Fix issue that missing values in a grib runtime axis would prevent all times after from being read due to axis being marked regular --- .../ucar/nc2/ft2/coverage/CoverageCoordAxisBuilder.java | 6 +++++- .../java/ucar/nc2/grib/coverage/GribCoverageDataset.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cdm/core/src/main/java/ucar/nc2/ft2/coverage/CoverageCoordAxisBuilder.java b/cdm/core/src/main/java/ucar/nc2/ft2/coverage/CoverageCoordAxisBuilder.java index 94df27c8f9..6d90ca4733 100644 --- a/cdm/core/src/main/java/ucar/nc2/ft2/coverage/CoverageCoordAxisBuilder.java +++ b/cdm/core/src/main/java/ucar/nc2/ft2/coverage/CoverageCoordAxisBuilder.java @@ -133,6 +133,10 @@ public CoverageCoordAxisBuilder setDependsOn(String dependsOn) { // for point: values are the points, values[npts] // for intervals: values are the edges, values[2*npts]: low0, high0, low1, high1 + public void setMissingTolerance(double tolerance) { + missingTolerance = tolerance; + } + public void setSpacingFromValues(boolean isInterval) { if (isInterval) { setSpacingFromIntervalValues(); @@ -227,7 +231,7 @@ private void setSpacingFromIntervalValues() { } } - private static final double missingTolerance = .05; + private double missingTolerance = .05; private boolean isRegular(Counters.Counter resol) { if (resol.getUnique() == 1) { diff --git a/grib/src/main/java/ucar/nc2/grib/coverage/GribCoverageDataset.java b/grib/src/main/java/ucar/nc2/grib/coverage/GribCoverageDataset.java index 40885ceed7..0c544ea77e 100644 --- a/grib/src/main/java/ucar/nc2/grib/coverage/GribCoverageDataset.java +++ b/grib/src/main/java/ucar/nc2/grib/coverage/GribCoverageDataset.java @@ -852,6 +852,7 @@ private CoverageCoordAxis makeRuntimeAuxCoord(CoordinateTimeAbstract time) { CoverageCoordAxisBuilder builder = new CoverageCoordAxisBuilder(refName, master.getUnit(), Grib.GRIB_RUNTIME, DataType.DOUBLE, AxisType.RunTime, atts, CoverageCoordAxis.DependenceType.dependent, time.getName(), null, length, 0, 0, 0, data, this); + builder.setMissingTolerance(0.0); builder.setSpacingFromValues(false); return new CoverageCoordAxis1D(builder);