Skip to content

Commit

Permalink
Spotify
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanrd authored and tdrwenski committed Oct 19, 2023
1 parent a9aa6d9 commit 0a0493f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
7 changes: 3 additions & 4 deletions grib/src/main/java/ucar/nc2/grib/collection/GribIosp.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,8 @@ private String makeTimeOffsetOrthogonal(Group.Builder g, CoordinateTime2D time2D
bounds = new double[2 * n];
List<TimeCoordIntvValue> intervals = (List<TimeCoordIntvValue>) 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TimeCoordIntvValue> timeIntervals, double[] timeCoordValues, double[] bounds, int runOffsetIndex, int timeUnitValue, int time2D_Offset) {
public static int generateTimeCoordValuesFromTimeCoordIntervals(List<TimeCoordIntvValue> timeIntervals,
double[] timeCoordValues, double[] bounds, int runOffsetIndex, int timeUnitValue, int time2D_Offset) {
int dataIndex = runOffsetIndex;
int boundsIndex = runOffsetIndex * 2;
double[] currentBounds = new double[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0a0493f

Please sign in to comment.