@Override Index reduce(int dim) { if ((dim < 0) || (dim >= rank)) throw new IllegalArgumentException("illegal reduce dim " + dim); if (shape[dim] != 1) throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1"); Section curr = new Section(shape); Section want = curr.removeRange(dim); return new IndexConstant( want.getShape()); }
@Override Index reduce(int dim) { if ((dim < 0) || (dim >= rank)) throw new IllegalArgumentException("illegal reduce dim " + dim); if (shape[dim] != 1) throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1"); Section curr = new Section(shape); Section want = curr.removeRange(dim); return new IndexConstant( want.getShape()); }
@Override Index reduce(int dim) { if ((dim < 0) || (dim >= rank)) throw new IllegalArgumentException("illegal reduce dim " + dim); if (shape[dim] != 1) throw new IllegalArgumentException("illegal reduce dim " + dim + " : length != 1"); Section curr = new Section(shape); Section want = curr.removeRange(dim); return new IndexConstant( want.getShape()); }
public void testErie() throws IOException, InvalidRangeException { String uri = TestDir.cdmUnitTestDir + "transforms/erie_test.ncml"; String var = "temp"; GridDataset ds = GridDataset.open(uri); GeoGrid grid = ds.findGridByName(var); Section s = new Section(grid.getShape()); System.out.printf("var = %s %n", s); GridCoordSystem gcs = grid.getCoordinateSystem(); VerticalTransform vt = gcs.getVerticalTransform(); ArrayDouble.D3 z = vt.getCoordinateArray(0); Section sv = new Section(z.getShape()); System.out.printf("3dcoord = %s %n", sv); s = s.removeRange(0); assert s.equals(sv); }
private void testGrid(String uri, String var) throws IOException, InvalidRangeException { GridDataset ds = null; try { ds = GridDataset.open(uri); GeoGrid grid = ds.findGridByName(var); Section s = new Section(grid.getShape()); System.out.printf("var = %s %n", s); GridCoordSystem GridCoordS = grid.getCoordinateSystem(); VerticalTransform vt = GridCoordS.getVerticalTransform(); ArrayDouble.D3 z = vt.getCoordinateArray(0); Section sv = new Section(z.getShape()); System.out.printf("3dcoord = %s %n", sv); if (vt.isTimeDependent()) s = s.removeRange(0); assert s.equals(sv); } finally { if (ds != null) ds.close(); } }
assert vt.isTimeDependent(); varSection = varSection.removeRange(0); // remove time dependence for comparision