@Override public String getName() { return "Multidim(" + outer.getShortName()+"," + inner.getShortName() + ")"; } }
@Override public String getName() { return "Multidim(" + outer.getShortName()+"," + inner.getShortName() + ")"; } }
/** * Dimensions with the same name are equal. * @param o compare to this Dimension * @return 0, 1, or -1 */ public int compareTo(Object o) { Dimension odim = (Dimension) o; String name = getShortName(); return name.compareTo(odim.getShortName()); }
private boolean contains(List<Dimension> dims, Dimension want) { for (Dimension have : dims) { if (have.getShortName().equals(want.getShortName())) return true; } return false; }
/** * Dimensions with the same name are equal. This method is inconsistent with equals()! * * @param o compare to this Dimension * @return 0, 1, or -1 */ public int compareTo(Object o) { Dimension odim = (Dimension) o; String name = getShortName(); return name.compareTo(odim.getShortName()); }
String makeDimensions(List<Dimension> dims) { StringBuilder sbuff = new StringBuilder(); sbuff.append(timeDimName); for (Dimension d : dims) { if (d.getShortName().equals(runtimeDimName) || d.getShortName().equals(timeDimName)) continue; sbuff.append(" ").append(d.getShortName()); } return sbuff.toString(); }
private boolean isStaggered2(CoordinateAxis axis, int dimIndex) { if (axis == null) return false; Dimension dim = axis.getDimension(dimIndex); return dim != null && dim.getShortName().endsWith("stag"); }
/** * Find the dimension pointed to by key * * @param ds in this dataset * @param key may be dimension name or ":gatt" where gatt is local attribute whose value is the dimension name * @param errlog error messages here * @return name of dimension or null if not exist */ static public String getDimensionName(NetcdfDataset ds, String key, Formatter errlog) { Dimension d = getDimension(ds, key, errlog); return (d == null) ? null : d.getShortName(); }
private boolean isStaggered2(CoordinateAxis axis, int dimIndex) { if (axis == null) return false; Dimension dim = axis.getDimension(dimIndex); if (dim == null) return false; if (dim.getShortName().endsWith("stag")) return true; return false; }
/** * Add a shared Dimension * * @param d add this Dimension */ public void addDimension(Dimension d) { if (immutable) throw new IllegalStateException("Cant modify"); if (findDimensionLocal(d.getShortName()) != null) throw new IllegalArgumentException("Dimension name (" + d.getShortName() + ") must be unique within Group " + getShortName()); dimensions.add(d); d.setGroup(this); }
public boolean addDimensionIfNotExists(Dimension d) { if (immutable) throw new IllegalStateException("Cant modify"); if (findDimensionLocal(d.getShortName()) != null) return false; dimensions.add(d); d.setGroup(this); return true; }
@Override public void hashCodeShow(Indent indent) { System.out.printf("%sDim hash = %d%n", indent, hashCode()); System.out.printf("%s shortName '%s' = %d%n", indent, getShortName(), getShortName() == null ? -1 : getShortName().hashCode()); System.out.printf("%s getLength %s%n", indent, getLength()); System.out.printf("%s isUnlimited %s%n", indent, isUnlimited()); System.out.printf("%s isVariableLength %s%n", indent, isVariableLength()); System.out.printf("%s isShared %s%n", indent, isShared()); if (getGroup() != null) System.out.printf("%s parentGroup %s = %d%n", indent, getGroup(), getGroup().hashCode()); }
private CoordinateAxis makeFakeCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) { if (dim == null) return null; CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.SHORT, dim.getShortName(), "", "synthesized coordinate: only an index"); v.addAttribute(new Attribute(_Coordinate.AxisType, "GeoZ")); if (!axisName.equals(dim.getShortName())) v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName())); v.setValues(dim.getLength(), 0, 1); return v; }
private CoordinateAxis makeFakeCoordAxis(NetcdfDataset ds, String axisName, Dimension dim) { if (dim == null) return null; CoordinateAxis v = new CoordinateAxis1D(ds, null, axisName, DataType.SHORT, dim.getShortName(), "", "synthesized coordinate: only an index"); v.addAttribute(new Attribute(_Coordinate.AxisType, "GeoZ")); if (!axisName.equals(dim.getShortName())) v.addAttribute(new Attribute(_Coordinate.AliasForDimension, dim.getShortName())); ds.setValues(v, dim.getLength(), 0, 1); return v; }
private boolean isTiled(Variable v) { for (Dimension d : v.getDimensions()) { for (Range r : section.getRanges()) { if (d.getShortName().equals(r.getName())) return true; } } return false; }
private boolean isTiled(Variable v) { for (Dimension d : v.getDimensions()) { for (Range r : section.getRanges()) { if (d.getShortName().equals(r.getName())) return true; } } return false; }
private TableConfig makeRaggedContiguousChildTable(NetcdfDataset ds, Dimension parentDim, Dimension childDim, Structure childStruct, Formatter errlog) throws IOException { TableConfig childTable = new TableConfig(Table.Type.Contiguous, 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, childStruct, childDim); return childTable; }
private Element makeDim( Dimension dim) { Element dimElem = new Element("dimension", thredds.client.catalog.Catalog.ncmlNS); dimElem.setAttribute("name", dim.getShortName()); dimElem.setAttribute("length", Integer.toString(dim.getLength())); if (dim.isUnlimited()) dimElem.setAttribute("isUnlimited", "true"); return dimElem; }
static NcStreamProto.Dimension.Builder encodeDim(Dimension dim) { NcStreamProto.Dimension.Builder dimBuilder = NcStreamProto.Dimension.newBuilder(); if (dim.getShortName() != null) dimBuilder.setName(dim.getShortName()); if (!dim.isVariableLength()) dimBuilder.setLength(dim.getLength()); dimBuilder.setIsPrivate(!dim.isShared()); dimBuilder.setIsVlen(dim.isVariableLength()); dimBuilder.setIsUnlimited(dim.isUnlimited()); return dimBuilder; }
public static Element writeDimension(Dimension dim, Namespace ns) { Element dimElem = new Element("dimension", ns); dimElem.setAttribute("name", dim.getShortName()); dimElem.setAttribute("length", Integer.toString(dim.getLength())); if (dim.isUnlimited()) dimElem.setAttribute("isUnlimited", "true"); if (dim.isVariableLength()) dimElem.setAttribute("isVariableLength", "true"); return dimElem; }