public int[] getShapeAll() { if (getParentStructure() == null) return getShape(); List<Dimension> dimAll = getDimensionsAll(); int[] shapeAll = new int[dimAll.size()]; for (int i=0; i<dimAll.size(); i++) shapeAll[i] = dimAll.get(i).getLength(); return shapeAll; }
public int[] getShapeAll() { if (getParentStructure() == null) return getShape(); List<Dimension> dimAll = getDimensionsAll(); int[] shapeAll = new int[dimAll.size()]; for (int i = 0; i < dimAll.size(); i++) shapeAll[i] = dimAll.get(i).getLength(); return shapeAll; }
public int[] getShapeAll() { if (getParentStructure() == null) return getShape(); List<Dimension> dimAll = getDimensionsAll(); int[] shapeAll = new int[dimAll.size()]; for (int i = 0; i < dimAll.size(); i++) shapeAll[i] = dimAll.get(i).getLength(); return shapeAll; }
static private StructureDS getWrappingParent( NetcdfDataset ds, Variable v) { String name = v.getParentStructure().getFullNameEscaped(); return (StructureDS) ds.findVariable(name); }
public Object clone() throws CloneNotSupportedException { Variable clone = (Variable)super.clone(); // Do we need to clone these? // protected Cache cache = new Cache(); // protected int sizeToCache = -1; // bytes clone.setParentGroup(group); clone.setParentStructure(getParentStructure()); clone.setProxyReader(clone); return clone; }
private void addDimensionsAll(List<Dimension> result, Variable v) { if (v.isMemberOfStructure()) addDimensionsAll(result, v.getParentStructure()); for (int i = 0; i < v.getRank(); i++) result.add(v.getDimension(i)); }
private void addDimensionsAll(List<Dimension> result, Variable v) { if (v.isMemberOfStructure()) addDimensionsAll(result, v.getParentStructure()); for (int i = 0; i < v.getRank(); i++) result.add(v.getDimension(i)); }
private void addDimensionsAll(List<Dimension> result, Variable v) { if (v.isMemberOfStructure()) addDimensionsAll(result, v.getParentStructure()); for (int i=0; i<v.getRank(); i++) result.add( v.getDimension(i)); }
/** * Override Object.hashCode() to implement equals. */ public int hashCode() { if(CDMNode.OBJECTHASH) return super.hashCode(); else { if (hashCode == 0) { int result = 17; result = 37 * result + getShortName().hashCode(); if (isScalar()) result++; result = 37 * result + getDataType().hashCode(); result = 37 * result + getParentGroup().hashCode(); if (getParentStructure() != null) result = 37 * result + getParentStructure().hashCode(); if (isVariableLength) result++; result = 37 * result + dimensions.hashCode(); hashCode = result; } return hashCode; } }
public void hashCodeShow(Indent indent) { System.out.printf("%sVar hash = %d%n", indent, hashCode()); System.out.printf("%s shortName %s = %d%n", indent, getShortName(), getShortName().hashCode()); System.out.printf("%s isScalar %s%n", indent, isScalar()); System.out.printf("%s dataType %s%n", indent, getDataType()); System.out.printf("%s parentGroup %s = %d%n", indent, getParentGroup(), getParentGroup().hashCode()); System.out.printf("%s isVariableLength %s%n", indent, isVariableLength); System.out.printf("%s dimensions %d len=%d%n", indent, dimensions.hashCode(), dimensions.size()); indent.incr(); for (Dimension d : dimensions) { d.hashCodeShow(indent); } indent.decr(); if (getParentStructure() != null) { System.out.printf("%s parentStructure %d%n", indent, getParentStructure().hashCode()); getParentStructure().hashCodeShow(indent.incr()); indent.decr(); } }
private int addParents(StringBuilder buff, Variable s, List<Range> section, int start) { Structure parent = s.getParentStructure(); if (parent != null) { start = addParents(buff, parent, section, start); buff.append("."); } List<Range> subSection = section.subList(start, start + s.getRank()); buff.append(getDODSConstraintName(s)); if (!s.isVariableLength()) // have to get the whole thing for a sequence !! makeSelector(buff, subSection); return start + s.getRank(); }
/** * Override Object.hashCode() to implement equals. */ @Override public int hashCode() { if (hashCode == 0) { int result = 17; result = 37 * result + getShortName().hashCode(); if (isScalar()) result++; result = 37 * result + getDataType().hashCode(); result = 37 * result + getParentGroup().hashCode(); if (getParentStructure() != null) result = 37 * result + getParentStructure().hashCode(); if (isVariableLength) result++; result = 37 * result + dimensions.hashCode(); hashCode = result; } return hashCode; }
/** * Override Object.hashCode() to implement equals. */ @Override public int hashCode() { if (hashCode == 0) { int result = 17; result = 37 * result + getShortName().hashCode(); if (isScalar()) result++; result = 37 * result + getDataType().hashCode(); result = 37 * result + getParentGroup().hashCode(); if (getParentStructure() != null) result = 37 * result + getParentStructure().hashCode(); if (isVariableLength) result++; result = 37 * result + dimensions.hashCode(); hashCode = result; } return hashCode; }
/** * Instances which have same content are equal. */ public boolean equals(Object oo) { if (this == oo) return true; if (!(oo instanceof Variable)) return false; Variable o = (Variable) oo; if (!getShortName().equals(o.getShortName())) return false; if (isScalar() != o.isScalar()) return false; if (getDataType() != o.getDataType()) return false; if (!getParentGroup().equals(o.getParentGroup())) return false; if ((getParentStructure() != null) && !getParentStructure().equals(o.getParentStructure())) return false; if (isVariableLength() != o.isVariableLength()) return false; if (dimensions.size() != o.getDimensions().size()) return false; for (int i = 0; i < dimensions.size(); i++) if (!getDimension(i).equals(o.getDimension(i))) return false; return true; }
/** * Instances which have same content are equal. */ public boolean equals(Object oo) { if (this == oo) return true; if (!(oo instanceof Variable)) return false; Variable o = (Variable) oo; if (!getShortName().equals(o.getShortName())) return false; if (isScalar() != o.isScalar()) return false; if (getDataType() != o.getDataType()) return false; if (!getParentGroup().equals(o.getParentGroup())) return false; if ((getParentStructure() != null) && !getParentStructure().equals(o.getParentStructure())) return false; if (isVariableLength() != o.isVariableLength()) return false; if (dimensions.size() != o.getDimensions().size()) return false; for (int i=0; i<dimensions.size(); i++) if (!getDimension(i).equals(o.getDimension(i))) return false; return true; }
/** * Instances which have same content are equal. */ public boolean equals(Object oo) { if (this == oo) return true; if (!(oo instanceof Variable)) return false; Variable o = (Variable) oo; if (!getShortName().equals(o.getShortName())) return false; if (isScalar() != o.isScalar()) return false; if (getDataType() != o.getDataType()) return false; if (!getParentGroup().equals(o.getParentGroup())) return false; if ((getParentStructure() != null) && !getParentStructure().equals(o.getParentStructure())) return false; if (isVariableLength() != o.isVariableLength()) return false; if (dimensions.size() != o.getDimensions().size()) return false; for (int i = 0; i < dimensions.size(); i++) if (!getDimension(i).equals(o.getDimension(i))) return false; return true; }
@Override protected boolean identifyEncodingTraj(NetcdfDataset ds, EncodingInfo info, Formatter errlog) { // find the obs structure info.childStruct = info.lat.getParentStructure(); Dimension obsDim = info.childStruct.getDimension(0); // find the traj structure Variable varatt = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = varatt.getParentStructure(); if (traj.getRank() == 0) { // could be scalar info.set(Encoding.single, null, obsDim); } Dimension trajDim = traj.getDimension(0); if (identifyRaggeds(ds, info, trajDim, obsDim, errlog)) return true; errlog.format("CFpointObsExt: %s only supports ragged array representation%n", CF.FeatureType.trajectory); return false; }
@Override protected boolean identifyEncodingTraj(NetcdfDataset ds, EncodingInfo info, Formatter errlog) { // find the obs structure info.childStruct = info.lat.getParentStructure(); Dimension obsDim = info.childStruct.getDimension(0); // find the traj structure Variable varatt = Evaluator.findVariableWithAttributeValue(ds, CF.CF_ROLE, CF.TRAJECTORY_ID); Structure traj = varatt.getParentStructure(); if (traj.getRank() == 0) { // could be scalar info.set(Encoding.single, null, obsDim); } Dimension trajDim = traj.getDimension(0); if (identifyRaggeds(ds, info, trajDim, obsDim, errlog)) return true; errlog.format("CFpointObsExt: %s only supports ragged array representation%n", CF.FeatureType.trajectory); return false; }
private TableConfig makeRaggedIndexChildTable(NetcdfDataset ds, Dimension parentDim, Dimension childDim, Variable ragged_parentIndex, Formatter errlog) throws IOException { TableConfig childTable = new TableConfig(Table.Type.ParentIndex, childDim.getShortName()); childTable.dimName = childDim.getShortName(); childTable.lat = matchAxisTypeAndDimension(ds, AxisType.Lat, childDim); childTable.lon = matchAxisTypeAndDimension(ds, AxisType.Lon, childDim); childTable.elev = matchAxisTypeAndDimension(ds, AxisType.Height, childDim); if (childTable.elev == null) childTable.elev = matchAxisTypeAndDimension(ds, AxisType.Pressure, childDim); if (childTable.elev == null) childTable.elev = matchAxisTypeAndDimension(ds, AxisType.GeoZ, childDim); childTable.time = matchAxisTypeAndDimension(ds, AxisType.Time, childDim); makeStructureInfo(childTable, ds, ragged_parentIndex.getParentStructure(), childDim); childTable.parentIndex = ragged_parentIndex.getFullName(); return childTable; }
private TableConfig makeRaggedIndexChildTable(NetcdfDataset ds, Dimension parentDim, Dimension childDim, Variable ragged_parentIndex, Formatter errlog) throws IOException { TableConfig childTable = new TableConfig(Table.Type.ParentIndex, childDim.getShortName()); childTable.dimName = childDim.getShortName(); childTable.lat = matchAxisTypeAndDimension(ds, AxisType.Lat, childDim); childTable.lon = matchAxisTypeAndDimension(ds, AxisType.Lon, childDim); childTable.elev = matchAxisTypeAndDimension(ds, AxisType.Height, childDim); if (childTable.elev == null) childTable.elev = matchAxisTypeAndDimension(ds, AxisType.Pressure, childDim); if (childTable.elev == null) childTable.elev = matchAxisTypeAndDimension(ds, AxisType.GeoZ, childDim); childTable.time = matchAxisTypeAndDimension(ds, AxisType.Time, childDim); makeStructureInfo(childTable, ds, ragged_parentIndex.getParentStructure(), childDim); childTable.parentIndex = ragged_parentIndex.getFullName(); return childTable; }