Class NetCDFDimensionIndexes
Object
NetCDFDimensionIndexes
Dimension indexes and lookup helpers used to resolve NetCDF slice dimensions from domain values.
Use regular-axis math when the coordinate variable is regular, and fall back to a compact array-backed lookup otherwise. The provided lookup implementations support exact-match queries as well as lower/upper bound style searches used by range filters.
This class is used by the slice-query machinery to convert requested time, elevation, and additional-domain values into dimension indices that can be iterated efficiently.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordArray-backed numeric lookup for irregular numeric axes.static final recordArray-backed time lookup for irregular temporal axes.static interfaceBase contract for a dimension axis lookup.static interfaceLookup interface for numeric axes such as elevation or additional numeric dimensions.static final recordRegular numeric axis lookup backed by size, start, and step.static final recordRegular time axis lookup backed by size, start, and step.static interfaceLookup interface for temporal axes such as the TIME dimension. -
Method Summary
Modifier and TypeMethodDescriptionstatic int[]contiguousRange(int startInclusive, int endExclusive) Returns a contiguous array of indices in the range [startInclusive, endExclusive).static intfirstIndexAfter(double[] values, double target, boolean inclusive) Returns the first index after the target on an ordered double array.static intfirstIndexAfter(long[] values, long target, boolean inclusive) Returns the first index after the target on an ordered long array.Creates a temporal lookup from an additional date coordinate variable.Creates a numeric lookup from an additional numeric coordinate variable.Creates a temporal lookup from a time coordinate variable.Creates a numeric lookup from a vertical coordinate variable.static intlastIndexBefore(double[] values, double target, boolean inclusive) Returns the exclusive upper bound index for values before the target on an ordered double array.static intlastIndexBefore(long[] values, long target, boolean inclusive) Returns the upper bound index for values before the target on an ordered long array.
-
Method Details
-
forTime
public static NetCDFDimensionIndexes.TimeAxisLookup forTime(CoordinateVariable<Date> cv) throws IOException Creates a temporal lookup from a time coordinate variable.- Throws:
IOException
-
forVertical
public static NetCDFDimensionIndexes.NumericAxisLookup forVertical(VariableAdapter.UnidataVerticalDomain domain) throws IOException Creates a numeric lookup from a vertical coordinate variable.- Throws:
IOException
-
forNumericAdditional
public static NetCDFDimensionIndexes.NumericAxisLookup forNumericAdditional(VariableAdapter.UnidataAdditionalDomain domain) throws IOException Creates a numeric lookup from an additional numeric coordinate variable.- Throws:
IOException
-
forDateAdditional
public static NetCDFDimensionIndexes.TimeAxisLookup forDateAdditional(VariableAdapter.UnidataAdditionalDomain domain) throws IOException Creates a temporal lookup from an additional date coordinate variable.- Throws:
IOException
-
contiguousRange
public static int[] contiguousRange(int startInclusive, int endExclusive) Returns a contiguous array of indices in the range [startInclusive, endExclusive). -
firstIndexAfter
public static int firstIndexAfter(long[] values, long target, boolean inclusive) Returns the first index after the target on an ordered long array. -
lastIndexBefore
public static int lastIndexBefore(long[] values, long target, boolean inclusive) Returns the upper bound index for values before the target on an ordered long array. -
firstIndexAfter
public static int firstIndexAfter(double[] values, double target, boolean inclusive) Returns the first index after the target on an ordered double array. -
lastIndexBefore
public static int lastIndexBefore(double[] values, double target, boolean inclusive) Returns the exclusive upper bound index for values before the target on an ordered double array.
-