/** * Read the data {@link ucar.ma2.Array} from the variable, at the specified * time index if applicable. If the variable does not have a time * dimension, the data array will have the same rank as the Variable. * If the variable has a time dimension, the data array will have rank-1. * * @param v variable to read * @param timeIndex time index, ignored if !isTimeDependent() * @return Array from the variable at that time index * * @throws IOException problem reading data * @throws InvalidRangeException _more_ */ protected Array readArray(Variable v, int timeIndex) throws IOException, InvalidRangeException { int[] shape = v.getShape(); int[] origin = new int[v.getRank()]; if (getTimeDimension() != null) { int dimIndex = v.findDimensionIndex(getTimeDimension().getShortName()); if (dimIndex >= 0) { shape[dimIndex] = 1; origin[dimIndex] = timeIndex; return v.read(origin, shape).reduce(dimIndex); } } return v.read(origin, shape); }
/** * Read the data {@link ucar.ma2.Array} from the variable, at the specified * time index if applicable. If the variable does not have a time * dimension, the data array will have the same rank as the Variable. * If the variable has a time dimension, the data array will have rank-1. * * @param v variable to read * @param timeIndex time index, ignored if !isTimeDependent() * @return Array from the variable at that time index * * @throws IOException problem reading data * @throws InvalidRangeException _more_ */ protected Array readArray(Variable v, int timeIndex) throws IOException, InvalidRangeException { int[] shape = v.getShape(); int[] origin = new int[v.getRank()]; if (getTimeDimension() != null) { int dimIndex = v.findDimensionIndex(getTimeDimension().getShortName()); if (dimIndex >= 0) { shape[dimIndex] = 1; origin[dimIndex] = timeIndex; return v.read(origin, shape).reduce(dimIndex); } } return v.read(origin, shape); }
/** * Read the data {@link ucar.ma2.Array} from the variable, at the specified * time index if applicable. If the variable does not have a time * dimension, the data array will have the same rank as the Variable. * If the variable has a time dimension, the data array will have rank-1. * * @param v variable to read * @param timeIndex time index, ignored if !isTimeDependent() * @return Array from the variable at that time index * * @throws IOException problem reading data * @throws InvalidRangeException _more_ */ protected Array readArray(Variable v, int timeIndex) throws IOException, InvalidRangeException { int[] shape = v.getShape(); int[] origin = new int[v.getRank()]; if (getTimeDimension() != null) { int dimIndex = v.findDimensionIndex(getTimeDimension().getShortName()); if (dimIndex >= 0) { shape[dimIndex] = 1; origin[dimIndex] = timeIndex; return v.read(origin, shape).reduce(dimIndex); } } return v.read(origin, shape); }