/** * Can this variable's size grow?. * This is equivalent to saying at least one of its dimensions is unlimited. * * @return boolean true iff this variable can grow */ public boolean isUnlimited() { for (Dimension d : dimensions) { if (d.isUnlimited()) return true; } return false; }
/** * Can this variable's size grow?. * This is equivalent to saying at least one of its dimensions is unlimited. * * @return boolean true iff this variable can grow */ public boolean isUnlimited() { for (Dimension d : dimensions) { if (d.isUnlimited()) return true; } return false; }
/** * Return the unlimited (record) dimension, or null if not exist. * If there are multiple unlimited dimensions, it will return the first one. * * @return the unlimited Dimension, or null if none. */ public Dimension getUnlimitedDimension() { for (Dimension d : dimensions) { if (d.isUnlimited()) return d; } return null; }
/** * Return the unlimited (record) dimension, or null if not exist. * If there are multiple unlimited dimensions, it will return the first one. * * @return the unlimited Dimension, or null if none. */ public Dimension getUnlimitedDimension() { for (Dimension d : dimensions) { if (d.isUnlimited()) return d; } return null; }
/** * Return the unlimited (record) dimension, or null if not exist. * If there are multiple unlimited dimensions, it will return the first one. * * @return the unlimited Dimension, or null if none. */ public Dimension getUnlimitedDimension() { for (Dimension d : dimensions) { if (d.isUnlimited()) return d; } return null; }
protected int[] convertUnlimitedShape(List<Dimension> dims) { int[] result = new int[dims.size()]; int count = 0; for (Dimension d : dims) { result[count++] = (d.isUnlimited()) ? 1 : d.getLength(); } return result; }
protected int[] convertUnlimitedShape(List<Dimension> dims) { int[] result = new int[dims.size()]; int count = 0; for (Dimension d : dims) { result[count++] = (d.isUnlimited()) ? 1 : d.getLength(); } return result; }
private long[] _computeChunkingUnlimited(Variable v) { List<Dimension> dims = v.getDimensions(); long[] result = new long[dims.size()]; int count = 0; for (Dimension d : dims) { if (d.isUnlimited()) result[count++] = 1; else result[count++] = d.getLength(); } return result; }
private long[] _computeChunking(Variable v) { List<Dimension> dims = v.getDimensions(); long[] result = new long[dims.size()]; int count = 0; for (Dimension d : dims) { if (d.isUnlimited()) result[count++] = 1; else result[count++] = d.getLength(); } return result; }
@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 void makeStructureInfo(TableConfig tableConfig, NetcdfDataset ds, Structure parent, Dimension dim) { tableConfig.dimName = dim.getShortName(); if (parent != null) { tableConfig.structureType = TableConfig.StructureType.Structure; tableConfig.structName = parent.getShortName(); } else { boolean hasNetcdf3Struct = Evaluator.hasNetcdf3RecordStructure(ds) && dim.isUnlimited(); tableConfig.structureType = hasNetcdf3Struct ? TableConfig.StructureType.Structure : TableConfig.StructureType.PsuedoStructure; tableConfig.structName = hasNetcdf3Struct ? "record" : dim.getShortName(); } }
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; }
private void makeStructureInfo(TableConfig tableConfig, NetcdfDataset ds, Structure parent, Dimension dim) { tableConfig.dimName = dim.getShortName(); if (parent != null) { tableConfig.structureType = TableConfig.StructureType.Structure; tableConfig.structName = parent.getShortName(); } else { boolean hasNetcdf3Struct = Evaluator.hasNetcdf3RecordStructure(ds) && dim.isUnlimited(); tableConfig.structureType = hasNetcdf3Struct ? TableConfig.StructureType.Structure : TableConfig.StructureType.PsuedoStructure; tableConfig.structName = hasNetcdf3Struct ? "record" : dim.getShortName(); } }
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; }
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; }
public void testDimensions(NetcdfFile ncfile) { Dimension latDim = ncfile.findDimension("lat"); assert null != latDim; assert latDim.getShortName().equals("lat"); assert latDim.getLength() == nlat; assert !latDim.isUnlimited(); Dimension lonDim = ncfile.findDimension("lon"); assert null != lonDim; assert lonDim.getShortName().equals("lon"); assert lonDim.getLength() == nlon; assert !lonDim.isUnlimited(); }
public void testStructure() { Dimension latDim = ncfile.findDimension("lat"); assert null != latDim; assert latDim.getShortName().equals("lat"); assert latDim.getLength() == 3; assert !latDim.isUnlimited(); Dimension timeDim = ncfile.findDimension("time"); assert null != timeDim; assert timeDim.getShortName().equals("time"); assert timeDim.getLength() == 4 : timeDim.getLength(); assert timeDim.isUnlimited(); }
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(); 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; }