public ArrayDouble.D3 getCoordinateArray(int subsetIndex) throws IOException, InvalidRangeException { int orgIndex = subsetIndex; if (isTimeDependent() && (t_range != null)) { orgIndex = t_range.element(subsetIndex); } ArrayDouble.D3 data = original.getCoordinateArray(orgIndex); return (ArrayDouble.D3) data.sectionNoReduce(subsetList); }
/** * Create a subset of an existing VerticalTransform * @param original make a subset of this * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it */ public VerticalTransformSubset(VerticalTransform original, Range t_range, Range z_range, Range y_range, Range x_range) { super(null); // timeDim not used in this class this.original = original; this.t_range = t_range; subsetList.add(z_range); subsetList.add(y_range); subsetList.add(x_range); units = original.getUnitString(); }
public boolean isTimeDependent() { return original.isTimeDependent(); } }
if (timeName == null) { vt = vct.makeVerticalTransform(ncd, null); assert !vt.isTimeDependent(); ucar.ma2.Array coordVals = vt.getCoordinateArray(0); assert (null != coordVals); assert null != timeDim; vt = vct.makeVerticalTransform(ncd, timeDim); assert vt.isTimeDependent(); ucar.ma2.ArrayDouble.D3 coordVals = vt.getCoordinateArray(i); assert (null != coordVals); Section cSection = new Section(coordVals.getShape()); String vertCoordUnit = vt.getUnitString(); assert vunit.isCompatible(vertCoordUnit) : vertCoordUnit + " not udunits compatible with " + vunit.getUnitString();
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(); } }
private void testGrid( GeoGrid grid) throws IOException, InvalidRangeException { assert null != grid; GridCoordSystem gcs = grid.getCoordinateSystem(); assert null != gcs; assert grid.getRank() == 4; Array data = grid.readDataSlice(0, -1, -1, -1); assert data.getRank() == 3; CoordinateAxis zaxis = gcs.getVerticalAxis(); assert data.getShape()[0] == zaxis.getSize() : zaxis.getSize(); CoordinateAxis yaxis = gcs.getYHorizAxis(); assert data.getShape()[1] == yaxis.getSize() : yaxis.getSize(); CoordinateAxis xaxis = gcs.getXHorizAxis(); assert data.getShape()[2] == xaxis.getSize() : xaxis.getSize(); VerticalTransform vt = gcs.getVerticalTransform(); assert vt != null; assert vt.getUnitString() != null; ucar.ma2.ArrayDouble.D3 vcoord = vt.getCoordinateArray(0); assert vcoord.getShape()[0] == zaxis.getSize() : vcoord.getShape()[0]; assert vcoord.getShape()[1] == yaxis.getSize() : vcoord.getShape()[1]; assert vcoord.getShape()[2] == xaxis.getSize() : vcoord.getShape()[2]; }
vt = vtFrom.subset(t_range, z_range, y_range, x_range);
private double[] getVertTransformationForPoint(ProjectionPoint point, int timeIndex, GeoGrid grid) throws IOException, InvalidRangeException{ VerticalTransform vt = grid.getCoordinateSystem().getVerticalTransform(); //System.out.println(vt.isTimeDependent()); int[] pointIndices = new int[]{0,0}; grid.getCoordinateSystem().findXYindexFromCoord( point.getX(), point.getY(), pointIndices); ArrayDouble.D1 dataArr = vt.getCoordinateArray1D(timeIndex, pointIndices[0], pointIndices[1]); return (double[])dataArr.copyTo1DJavaArray(); }
vt = vtFrom.subset(t_range, z_range, y_range, x_range);
public ArrayDouble.D3 getCoordinateArray(int subsetIndex) throws IOException, InvalidRangeException { int orgIndex = subsetIndex; if (isTimeDependent() && (t_range != null)) { orgIndex = t_range.element(subsetIndex); } ArrayDouble.D3 data = original.getCoordinateArray(orgIndex); return (ArrayDouble.D3) data.sectionNoReduce(subsetList); }
/** * Create a subset of an existing VerticalTransform * @param original make a subset of this * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it */ public VerticalTransformSubset(VerticalTransform original, Range t_range, Range z_range, Range y_range, Range x_range) { super(null); // timeDim not used in this class this.original = original; this.t_range = t_range; subsetList.add(z_range); subsetList.add(y_range); subsetList.add(x_range); units = original.getUnitString(); }
public boolean isTimeDependent() { return original.isTimeDependent(); } }
vt = vtFrom.subset(t_range, z_range, y_range, x_range);
public ArrayDouble.D3 getCoordinateArray(int subsetIndex) throws IOException, InvalidRangeException { int orgIndex = subsetIndex; if (isTimeDependent() && (t_range != null)) { orgIndex = t_range.element(subsetIndex); } ArrayDouble.D3 data = original.getCoordinateArray(orgIndex); return (ArrayDouble.D3) data.sectionNoReduce(subsetList); }
/** * Create a subset of an existing VerticalTransform * @param original make a subset of this * @param t_range subset the time dimension, or null if you want all of it * @param z_range subset the vertical dimension, or null if you want all of it * @param y_range subset the y dimension, or null if you want all of it * @param x_range subset the x dimension, or null if you want all of it */ public VerticalTransformSubset(VerticalTransform original, Range t_range, Range z_range, Range y_range, Range x_range) { super(null); // timeDim not used in this class this.original = original; this.t_range = t_range; subsetList.add(z_range); subsetList.add(y_range); subsetList.add(x_range); units = original.getUnitString(); }
public boolean isTimeDependent() { return original.isTimeDependent(); } }
ArrayDouble.D3 data = original.getCoordinateArray(timeIndex);
@Test @Category(NeedsCdmUnitTest.class) public void testWRF() throws Exception { try(GridDataset dataset = GridDataset.open(TestDir.cdmUnitTestDir + "conventions/wrf/wrfout_v2_Lambert.nc")) { GeoGrid grid = dataset.findGridByName("T"); assert null != grid; GridCoordSystem gcs = grid.getCoordinateSystem(); assert null != gcs; assert grid.getRank() == 4; CoordinateAxis zaxis = gcs.getVerticalAxis(); assert zaxis.getSize() == 27; VerticalTransform vt = gcs.getVerticalTransform(); assert vt != null; assert vt.getUnitString().equals("Pa"); GeoGrid grid_section = grid.subset(null, null, null, 3, 3, 3); Array data = grid_section.readDataSlice(-1, -1, -1, -1); assert data.getShape()[0] == 13 : data.getShape()[0]; assert data.getShape()[1] == 9 : data.getShape()[1]; assert data.getShape()[2] == 20 : data.getShape()[2]; assert data.getShape()[3] == 25 : data.getShape()[3]; GridCoordSystem gcs_section = grid_section.getCoordinateSystem(); CoordinateAxis zaxis2 = gcs_section.getVerticalAxis(); assert zaxis2.getSize() == 9 : zaxis2.getSize(); assert zaxis2.getUnitsString().equals(zaxis.getUnitsString()); assert gcs_section.getTimeAxis().equals(gcs.getTimeAxis()); VerticalTransform vt_section = gcs_section.getVerticalTransform(); assert vt_section != null; assert vt_section.getUnitString().equals(vt.getUnitString()); } }
ArrayDouble.D3 data = original.getCoordinateArray(timeIndex);
ArrayDouble.D3 data = original.getCoordinateArray(timeIndex);