@Override public void toString(Formatter f, Indent indent) { super.toString(f, indent); f.format("%s %s%n", indent, Misc.showInts(shape)); Array data = getCoordsAsArray(); f.format("%s%n", NCdumpW.toString(data, getName() + " values", null)); }
public int[] getShape() { return timeAxis2D.getShape(); }
@Override public Array getCoordsAsArray() { double[] values = getValues(); return Array.factory(DataType.DOUBLE, shape, values); }
@Override public CoverageCoordAxis copy() { return new TimeAxis2DFmrc(new CoverageCoordAxisBuilder(this)); }
@Override public Optional<CoverageCoordAxis> subset(SubsetParams params) { if (params == null) return Optional.of(new TimeAxis2DFmrc(new CoverageCoordAxisBuilder(this))); CalendarDate rundate = (CalendarDate) params.get(SubsetParams.runtime); boolean runtimeAll = (Boolean) params.get(SubsetParams.runtimeAll); boolean latest = (rundate == null) && !runtimeAll; // default is latest int run_index = -1; if (latest) { run_index = runCoord.getNcoords() - 1; } else if (rundate != null){ double rundateTarget = runCoord.convert(rundate); CoordAxisHelper helper = new CoordAxisHelper(runCoord); run_index = helper.findCoordElement(rundateTarget, true); // LOOK Bounded } if (run_index >= 0) { CoverageCoordAxis1D time1D = getTimeAxisForRun(run_index); return time1D.subset(params); } // no subsetting needed return Optional.of(new TimeAxis2DFmrc(new CoverageCoordAxisBuilder(this))); }
public CoverageCoordAxis1D getTimeAxisForRun(int run_index) { if (spacing == Spacing.irregularPoint) { Array data = getCoordsAsArray(); Array subset = data.slice(0, run_index); dependenceType, getDependsOn(), spacing, n, values[0], values[n - 1], 0.0, values, reader); builder.setIsSubset(true); Array data = getCoordBoundsAsArray(); Array subset = data.slice(0, run_index); dependenceType, getDependsOn(), spacing, n / 2, values[0], values[n - 1], 0.0, values, reader);
public CoverageCoordAxis1D getTimeAxisForRun(CalendarDate rundate) { double rundateTarget = runCoord.convert(rundate); int run_index = new CoordAxisHelper(runCoord).findCoordElement(rundateTarget, false); // LOOK not Bounded return (run_index < 0 || run_index >= runCoord.getNcoords()) ? null : getTimeAxisForRun(run_index); }
@Override public Optional<CoverageCoordAxis> subset(double minValue, double maxValue, int stride) { // LOOK not implemented, maybe illegal ?? return Optional.of(new TimeAxis2DFmrc(new CoverageCoordAxisBuilder(this))); }
if (ftype == FeatureType.FMRC) { builder.setDependsOn(dtCoordAxis.getDimension(0).getFullName()); // only the first dimension return ucar.nc2.util.Optional.of(new TimeAxis2DFmrc(builder));
@Override public Array getCoordBoundsAsArray() { double[] values = getValues(); int[] shapeB = new int[3]; System.arraycopy(shape, 0, shapeB, 0, 2); shapeB[2] = 2; return Array.factory(DataType.DOUBLE, shapeB, values); }
builder.setSpacingFromValues(time2D.isTimeInterval()); return new TimeAxis2DFmrc(builder); // LOOK should be FmrcTimeAxisReg2D to take advantage of regular