System.out.println(" dump of ctv = \n" + lev);
VariableDS v = (VariableDS) ncd.findVariable(varName);
assert v != null;
System.out.printf(" data variable = %s%n", v);
Section varSection = new Section(v.getShapeAsSection());
List cList = v.getCoordinateSystems();
assert cList != null;
assert cList.size() == 1;
CoordinateSystem csys = (CoordinateSystem) cList.get(0);
List<CoordinateTransform> vList = new ArrayList<CoordinateTransform>();
for (CoordinateTransform ct : csys.getCoordinateTransforms()) {
if (ct.getTransformType() == TransformType.Vertical)
vList.add(ct);
}
assert vList.size() == 1;
CoordinateTransform ct = (CoordinateTransform) vList.get(0);
assert ct.getTransformType() == TransformType.Vertical;
assert ct instanceof VerticalCT;
VerticalCT vct = (VerticalCT) ct;
assert vct.getVerticalTransformType() == vtype : vct.getVerticalTransformType();
VariableDS ctv = CoordTransBuilder.makeDummyTransformVariable(ncd, ct);
System.out.println(" dump of equivilent ctv = \n" + ctv);
VerticalTransform vt = null;
if (timeName == null) {
vt = vct.makeVerticalTransform(ncd, null);
assert !vt.isTimeDependent();
ucar.ma2.Array coordVals = vt.getCoordinateArray(0);
assert (null != coordVals);
Section cSection = new Section(coordVals.getShape());
System.out.printf(" coordVal shape = %s %n", cSection);
assert varSection.computeSize() == cSection.computeSize();
} else {
Dimension timeDim = ncd.findDimension(timeName);
assert null != timeDim;
vt = vct.makeVerticalTransform(ncd, timeDim);
assert vt.isTimeDependent();
varSection = varSection.removeRange(0); // remove time dependence for comparision
for (int i = 0; i < timeDim.getLength(); i++) {
ucar.ma2.ArrayDouble.D3 coordVals = vt.getCoordinateArray(i);
assert (null != coordVals);
Section cSection = new Section(coordVals.getShape());
System.out.printf("%s: varSection shape = %s %n", v.getFullName(), varSection);
System.out.printf("%s: coordVal shape = %s %n", v.getFullName(), cSection);
assert varSection.computeSize() == cSection.computeSize();
}
}
assert vt != null;
assert vclass.isInstance(vt);