private boolean checkDimensions(List<Dimension> list1, List<Dimension> list2) { boolean ok = true; for (Dimension d1 : list1) { if (d1.isShared()) ok &= list2.contains(d1); } return ok; }
private boolean checkDimensions(List<Dimension> list1, List<Dimension> list2) { boolean ok = true; for (Dimension d1 : list1) { if (d1.isShared()) { boolean hasit = list2.contains(d1); if (!hasit) f.format(" ** Missing dim %s not in file2 %n", d1); ok &= hasit; } } return ok; }
private boolean checkDimensions(List<Dimension> list1, List<Dimension> list2) { boolean ok = true; for (Dimension d1 : list1) { if (d1.isShared()) { boolean hasit = list2.contains(d1); if (!hasit) f.format(" ** Missing dim %s not in file2 %n", d1); ok &= hasit; } } return ok; }
static private void writeNcMLDimension( Variable v, PrintStream out) { out.print(" shape='"); java.util.List<Dimension> dims = v.getDimensions(); for (int j = 0; j < dims.size(); j++) { Dimension dim = dims.get(j); if (j != 0) out.print(" "); if (dim.isShared()) out.print(StringUtil2.quoteXmlAttribute(dim.getShortName())); else out.print(dim.getLength()); } out.print("'"); }
static private void writeNcMLDimension(Variable v, Formatter out) { out.format(" shape='"); java.util.List<Dimension> dims = v.getDimensions(); for (int j = 0; j < dims.size(); j++) { Dimension dim = dims.get(j); if (j != 0) out.format(" "); if (dim.isShared()) out.format("%s", StringUtil2.quoteXmlAttribute(dim.getShortName())); else out.format("%d", dim.getLength()); } out.format("'"); }
static private void writeNcMLDimension(Variable v, Formatter out) { out.format(" shape='"); java.util.List<Dimension> dims = v.getDimensions(); for (int j = 0; j < dims.size(); j++) { Dimension dim = dims.get(j); if (j != 0) out.format(" "); if (dim.isShared()) out.format("%s", StringUtil2.quoteXmlAttribute(dim.getShortName())); else out.format("%d", dim.getLength()); } out.format("'"); }
static private void writeNcMLDimension( Variable v, PrintStream out) { out.print(" shape='"); java.util.List<Dimension> dims = v.getDimensions(); for (int j = 0; j < dims.size(); j++) { Dimension dim = dims.get(j); if (j != 0) out.print(" "); if (dim.isShared()) out.print(StringUtil2.quoteXmlAttribute(dim.getShortName())); else out.print(dim.getLength()); } out.print("'"); }
private void findUsedDimensions(Group parent, Map<Dimension, List<Variable>> dimUsedMap) { for (Variable v : parent.getVariables()) { for (Dimension d : v.getDimensions()) { if (!d.isShared()) continue; List<Variable> vlist = dimUsedMap.get(d); if (vlist == null) { vlist = new ArrayList<Variable>(); dimUsedMap.put(d, vlist); } vlist.add(v); } } for (Group g : parent.getGroups()) findUsedDimensions(g, dimUsedMap); }
private void findUsedDimensions(Group parent, Map<Dimension, List<Variable>> dimUsedMap) { for (Variable v : parent.getVariables()) { for (Dimension d : v.getDimensions()) { if (!d.isShared()) continue; List<Variable> vlist = dimUsedMap.get(d); if (vlist == null) { vlist = new ArrayList<Variable>(); dimUsedMap.put(d, vlist); } vlist.add(v); } } for (Group g : parent.getGroups()) findUsedDimensions(g, dimUsedMap); }
@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()); }
@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 List<Dimension> getNewDimensions(Variable oldVar) { List<Dimension> result = new ArrayList<Dimension>(oldVar.getRank()); // dimensions for (Dimension oldD : oldVar.getDimensions()) { Dimension newD = gdimHash.get(oldD.getShortName()); if (newD == null) { newD = writer.addDimension(null, oldD.getShortName(), oldD.isUnlimited() ? 0 : oldD.getLength(), oldD.isShared(), oldD.isUnlimited(), oldD.isVariableLength()); gdimHash.put(oldD.getShortName(), newD); if (debug) System.out.println("add dim= " + newD); } result.add(newD); } return result; }
private List<Dimension> getNewDimensions(Variable oldVar) { List<Dimension> result = new ArrayList<>(oldVar.getRank()); // dimensions for (Dimension oldD : oldVar.getDimensions()) { Dimension newD = gdimHash.get(oldD.getShortName()); if (newD == null) { newD = writer.addDimension(null, oldD.getShortName(), oldD.isUnlimited() ? 0 : oldD.getLength(), oldD.isShared(), oldD.isUnlimited(), oldD.isVariableLength()); gdimHash.put(oldD.getShortName(), newD); if (debug) System.out.println("add dim= " + newD); } result.add(newD); } return result; }
public Element makeDimensionElement(Dimension dim) throws IllegalArgumentException { if (!dim.isShared()) { throw new IllegalArgumentException("Cannot create private dimension: " + "in NcML, <dimension> elements are always shared."); } Element dimElem = new Element("dimension", namespace); dimElem.setAttribute("name", dim.getShortName()); dimElem.setAttribute("length", Integer.toString(dim.getLength())); if (dim.isUnlimited()) dimElem.setAttribute("isUnlimited", "true"); return dimElem; }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
/** * Add a Dimension to the file * * @param dim copy this dimension * @return the new Dimension */ public Dimension writeDimension(Dimension dim) { String useName = N3iosp.makeValidNetcdfObjectName(dim.getShortName()); Dimension newDim = ncfile.addDimension(useName, dim.isUnlimited() ? 0 : dim.getLength(), dim.isShared(), dim.isUnlimited(), dim.isVariableLength()); dimHash.put(useName, newDim); if (debug) System.out.println("write dim= " + newDim); return newDim; }
static NcStreamProto.Dimension.Builder encodeDim(Dimension dim) { NcStreamProto.Dimension.Builder dimBuilder = NcStreamProto.Dimension.newBuilder(); if (dim.getShortName() != null) dimBuilder.setName(dim.getShortName()); dimBuilder.setLength(dim.getLength()); if (!dim.isShared()) dimBuilder.setIsPrivate(true); if (dim.isVariableLength()) dimBuilder.setIsVlen(true); if (dim.isUnlimited()) dimBuilder.setIsUnlimited(true); return dimBuilder; }
static NcStreamProto.Dimension.Builder encodeDim(Dimension dim) { NcStreamProto.Dimension.Builder dimBuilder = NcStreamProto.Dimension.newBuilder(); dimBuilder.setName(dim.getShortName() == null ? "" : dim.getShortName()); dimBuilder.setLength(dim.getLength()); if (!dim.isShared()) dimBuilder.setIsPrivate(true); if (dim.isVariableLength()) dimBuilder.setIsVlen(true); if (dim.isUnlimited()) dimBuilder.setIsUnlimited(true); return dimBuilder; }
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; }