From 0a0493fe0ed3bfc243b3b81adbc9a99efb81272b Mon Sep 17 00:00:00 2001 From: Ethan Davis Date: Fri, 13 Oct 2023 14:25:01 -0600 Subject: [PATCH] Spotify --- grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java | 7 +++---- .../java/ucar/nc2/grib/collection/GribIospBuilder.java | 3 ++- .../nc2/grib/collection/GribTimeCoordIntervalUtils.java | 8 +++++--- .../ucar/nc2/grib/coord/TestDiscontiguousInterval.java | 5 ++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java b/grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java index 499936d590..f770e6ea3b 100644 --- a/grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java +++ b/grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java @@ -784,10 +784,9 @@ private Array makeLazyTime2Darray(Variable coord, Time2Dinfo info) { int runOffsetIndex = runIdx * ntimes; int timeUnitValue = timeUnit.getValue(); int time2D_Offset = time2D.getOffset(runIdx); - assert(count == runOffsetIndex); - count = GribTimeCoordIntervalUtils.generateTimeCoordValuesFromTimeCoordIntervals( - timeIntv.getTimeIntervals(), data, null, - runOffsetIndex, timeUnitValue, time2D_Offset); + assert (count == runOffsetIndex); + count = GribTimeCoordIntervalUtils.generateTimeCoordValuesFromTimeCoordIntervals(timeIntv.getTimeIntervals(), + data, null, runOffsetIndex, timeUnitValue, time2D_Offset); } break; diff --git a/grib/src/main/java/ucar/nc2/grib/collection/GribIospBuilder.java b/grib/src/main/java/ucar/nc2/grib/collection/GribIospBuilder.java index 995fb33432..929e8d31f1 100644 --- a/grib/src/main/java/ucar/nc2/grib/collection/GribIospBuilder.java +++ b/grib/src/main/java/ucar/nc2/grib/collection/GribIospBuilder.java @@ -684,7 +684,8 @@ private String makeTimeOffsetOrthogonal(Group.Builder g, CoordinateTime2D time2D bounds = new double[2 * n]; List intervals = (List) offsets; // TODO Should this be using 'timeUnitValue'? Wasn't in previous incarnation. - int count = GribTimeCoordIntervalUtils.generateTimeCoordValuesFromTimeCoordIntervals(intervals, data, bounds, 0, timeUnitValue, 0); + int count = GribTimeCoordIntervalUtils.generateTimeCoordValuesFromTimeCoordIntervals(intervals, data, bounds, 0, + timeUnitValue, 0); assert (count == n); } else { int count = 0; diff --git a/grib/src/main/java/ucar/nc2/grib/collection/GribTimeCoordIntervalUtils.java b/grib/src/main/java/ucar/nc2/grib/collection/GribTimeCoordIntervalUtils.java index f9f1b7fbd9..df6973572f 100644 --- a/grib/src/main/java/ucar/nc2/grib/collection/GribTimeCoordIntervalUtils.java +++ b/grib/src/main/java/ucar/nc2/grib/collection/GribTimeCoordIntervalUtils.java @@ -22,15 +22,17 @@ enum TimeCoordValueDefaultLocationInIntervals { * end point then starting point. That sorting scheme is implemented in * ucar.nc2.grib.coord.TimeCoordIntvValue.compareTo(o) -- 21 Dec 2022. * - * @param timeIntervals given list of time coord intervals from which to calculate time coordinate values - * @param timeCoordValues array for storing generated time coord values, 1D array that may represent a 2D data array (run/forecast) + * @param timeIntervals given list of time coord intervals from which to calculate time coordinate values + * @param timeCoordValues array for storing generated time coord values, 1D array that may represent a 2D data array + * (run/forecast) * @param bounds array for storing interval bounds, may be null if bounds are loaded elsewhere. * @param runOffsetIndex * @param timeUnitValue time unit * @param time2D_Offset * @return the index into the timeCoordValues array following the last value written */ - public static int generateTimeCoordValuesFromTimeCoordIntervals(List timeIntervals, double[] timeCoordValues, double[] bounds, int runOffsetIndex, int timeUnitValue, int time2D_Offset) { + public static int generateTimeCoordValuesFromTimeCoordIntervals(List timeIntervals, + double[] timeCoordValues, double[] bounds, int runOffsetIndex, int timeUnitValue, int time2D_Offset) { int dataIndex = runOffsetIndex; int boundsIndex = runOffsetIndex * 2; double[] currentBounds = new double[2]; diff --git a/grib/src/test/java/ucar/nc2/grib/coord/TestDiscontiguousInterval.java b/grib/src/test/java/ucar/nc2/grib/coord/TestDiscontiguousInterval.java index 4a49befbef..4a7050535b 100644 --- a/grib/src/test/java/ucar/nc2/grib/coord/TestDiscontiguousInterval.java +++ b/grib/src/test/java/ucar/nc2/grib/coord/TestDiscontiguousInterval.java @@ -109,7 +109,7 @@ private void checkTimeCoord2D_fromIntervals_isStrictlyMonotonicallyIncreasing(St Variable dataVar = nc.findVariable(varName); Assert.assertNotNull(dataVar); - Variable reftimeVar = nc.findVariable( "reftime"); + Variable reftimeVar = nc.findVariable("reftime"); Array reftimeValues = reftimeVar.read(); Variable timeOffsetVar = nc.findVariable("timeOffset"); @@ -143,8 +143,7 @@ private void checkTimeCoord2D_fromIntervals_isStrictlyMonotonicallyIncreasing(St } } - private void checkTimeCoordVariable2D_IsStrictlyMonotonicallyIncreasing(int timeDimLength, - Array timeCoordValues) { + private void checkTimeCoordVariable2D_IsStrictlyMonotonicallyIncreasing(int timeDimLength, Array timeCoordValues) { double currentValue = timeCoordValues.getDouble(0); double prevValue = currentValue; StringBuilder valuesSoFar = new StringBuilder();