private void createDimensions(ucar.nc2.Group g, H5Group h5group) throws IOException { for (Dimension d : h5group.dimList) { g.addDimension(d); } }
private void createDimensions(ucar.nc2.Group g, H5Group h5group) throws IOException { for (Dimension d : h5group.dimList) { g.addDimension(d); } }
private void createDimensions(ucar.nc2.Group g, H5Group h5group) throws IOException { for (Dimension d : h5group.dimList) { g.addDimension(d); } }
/** * Add a shared Dimension to a Group. * * @param parent add to this group. If group is null, use root group * @param d add this Dimension * @return the dimension that was added */ public Dimension addDimension(Group parent, Dimension d) { if (immutable) throw new IllegalStateException("Cant modify"); if (parent == null) parent = rootGroup; parent.addDimension(d); return d; }
/** * Add a shared Dimension to a Group. * * @param parent add to this group. If group is null, use root group * @param d add this Dimension * @return the dimension that was added */ public Dimension addDimension(Group parent, Dimension d) { if (immutable) throw new IllegalStateException("Cant modify"); if (parent == null) parent = rootGroup; parent.addDimension(d); return d; }
/** * Add a shared Dimension to a Group. * * @param parent add to this group. If group is null, use root group * @param d add this Dimension * @return the dimension that was added */ public Dimension addDimension(Group parent, Dimension d) { if (immutable) throw new IllegalStateException("Cant modify"); if (parent == null) parent = rootGroup; parent.addDimension(d); return d; }
/** * Read an NcML dimension element. * * @param g put dimension into this group * @param dimElem ncml dimension element */ private void readDim(Group g, Element dimElem) { String name = dimElem.getAttributeValue("name"); if (name == null) { errlog.format("NcML Dimension name is required (%s)%n", dimElem); return; } String lengthS = dimElem.getAttributeValue("length"); String isUnlimitedS = dimElem.getAttributeValue("isUnlimited"); String isSharedS = dimElem.getAttributeValue("isShared"); String isUnknownS = dimElem.getAttributeValue("isVariableLength"); boolean isUnlimited = (isUnlimitedS != null) && isUnlimitedS.equalsIgnoreCase("true"); boolean isUnknown = (isUnknownS != null) && isUnknownS.equalsIgnoreCase("true"); boolean isShared = true; if ((isSharedS != null) && isSharedS.equalsIgnoreCase("false")) isShared = false; int len = Integer.parseInt(lengthS); if ((isUnknownS != null) && isUnknownS.equalsIgnoreCase("false")) len = Dimension.VLEN.getLength(); Dimension dim = new Dimension(name, len, isShared, isUnlimited, isUnknown); if (debugConstruct) System.out.println(" add new dim = " + dim); g.addDimension(dim); }
/** * Read an NcML dimension element. * * @param g put dimension into this group * @param dimElem ncml dimension element */ private void readDim(Group g, Element dimElem) { String name = dimElem.getAttributeValue("name"); if (name == null) { errlog.format("NcML Dimension name is required (%s)%n", dimElem); return; } String lengthS = dimElem.getAttributeValue("length"); String isUnlimitedS = dimElem.getAttributeValue("isUnlimited"); String isSharedS = dimElem.getAttributeValue("isShared"); String isUnknownS = dimElem.getAttributeValue("isVariableLength"); boolean isUnlimited = (isUnlimitedS != null) && isUnlimitedS.equalsIgnoreCase("true"); boolean isUnknown = (isUnknownS != null) && isUnknownS.equalsIgnoreCase("true"); boolean isShared = true; if ((isSharedS != null) && isSharedS.equalsIgnoreCase("false")) isShared = false; int len = Integer.parseInt(lengthS); if ((isUnknownS != null) && isUnknownS.equalsIgnoreCase("false")) len = Dimension.VLEN.getLength(); Dimension dim = new Dimension(name, len, isShared, isUnlimited, isUnknown); if (debugConstruct) System.out.println(" add new dim = " + dim); g.addDimension(dim); }
/** * Read an NcML dimension element. * * @param g put dimension into this group * @param dimElem ncml dimension element */ private void readDim(Group g, Element dimElem) { String name = dimElem.getAttributeValue("name"); if (name == null) { errlog.format("NcML Dimension name is required (%s)%n", dimElem); return; } String lengthS = dimElem.getAttributeValue("length"); String isUnlimitedS = dimElem.getAttributeValue("isUnlimited"); String isSharedS = dimElem.getAttributeValue("isShared"); String isUnknownS = dimElem.getAttributeValue("isVariableLength"); boolean isUnlimited = (isUnlimitedS != null) && isUnlimitedS.equalsIgnoreCase("true"); boolean isUnknown = (isUnknownS != null) && isUnknownS.equalsIgnoreCase("true"); boolean isShared = true; if ((isSharedS != null) && isSharedS.equalsIgnoreCase("false")) isShared = false; int len = Integer.parseInt(lengthS); if ((isUnknownS != null) && isUnknownS.equalsIgnoreCase("false")) len = Dimension.VLEN.getLength(); Dimension dim = new Dimension(name, len, isShared, isUnlimited, isUnknown); if (debugConstruct) System.out.println(" add new dim = " + dim); g.addDimension(dim); }
lowest.addDimension(dim); current.remove(dim);
lowest.addDimension(dim); current.remove(dim);
if (myd == null) { // add as shared myd = new Dimension(name, dad.getSize()); group.addDimension(myd); } else if (myd.getLength() != dad.getSize()) { // make a non-shared dimension myd = new Dimension(name, dad.getSize(), false);
/** * If an equivilent shared dimension already exists, use it, else add d to shared dimensions. * Equivilent is same name and length. * * @param group from this group, if null, use rootGroup * @param d find equivilent shared dimension to this one. * @return equivilent shared dimension or d. */ Dimension getSharedDimension(Group group, Dimension d) { if (d.getShortName() == null) return d; if (group == null) group = rootGroup; for (Dimension sd : group.getDimensions()) { if (sd.getShortName().equals(d.getShortName()) && sd.getLength() == d.getLength()) return sd; } d.setShared(true); group.addDimension(d); return d; }
private void makeCoordinateVariable(Group parentGroup, Variable v, Array data) { String name = v.getShortName(); // replace in Variable Dimension oldDimension = v.getDimension(0); Dimension newDimension = new Dimension(name, oldDimension.getLength()); // newDimension.setCoordinateAxis( v); calcCoordinateVaribale will do this v.setDimension(0, newDimension); // replace old (if it exists) in Group with shared dimension Dimension old = parentGroup.findDimension(name); parentGroup.remove(old); parentGroup.addDimension(newDimension); // might as well cache the data if (data != null) { v.setCachedData(data); if (debugCached) System.out.println(" cache for <" + name + "> length =" + data.getSize()); } }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }
private void convertGroup(Group g, Group from) { for (EnumTypedef et : from.getEnumTypedefs()) g.addEnumeration(et); for (Dimension d : from.getDimensions()) g.addDimension(new Dimension(d.getShortName(), d)); for (Attribute a : from.getAttributes()) g.addAttribute(a); for (Variable v : from.getVariables()) g.addVariable(convertVariable(g, v)); for (Group nested : from.getGroups()) { Group nnested = new Group(this, g, nested.getShortName()); g.addGroup(nnested); convertGroup(nnested, nested); } }
static void readGroup(NcStreamProto.Group proto, NetcdfFile ncfile, Group g) throws InvalidProtocolBufferException { for (NcStreamProto.Dimension dim : proto.getDimsList()) g.addDimension(NcStream.decodeDim(dim)); for (NcStreamProto.Attribute att : proto.getAttsList()) g.addAttribute(NcStream.decodeAtt(att)); for (NcStreamProto.EnumTypedef enumType : proto.getEnumTypesList()) g.addEnumeration(NcStream.decodeEnumTypedef(enumType)); for (NcStreamProto.Variable var : proto.getVarsList()) g.addVariable(NcStream.decodeVar(ncfile, g, null, var)); for (NcStreamProto.Structure s : proto.getStructsList()) g.addVariable(NcStream.decodeStructure(ncfile, g, null, s)); for (NcStreamProto.Group gp : proto.getGroupsList()) { Group ng = new Group(ncfile, g, gp.getName()); g.addGroup(ng); readGroup(gp, ncfile, ng); } }
static void readGroup(NcStreamProto.Group proto, NetcdfFile ncfile, Group g) throws InvalidProtocolBufferException { for (NcStreamProto.Dimension dim : proto.getDimsList()) g.addDimension(NcStream.decodeDim(dim)); for (NcStreamProto.Attribute att : proto.getAttsList()) g.addAttribute(NcStream.decodeAtt(att)); for (NcStreamProto.EnumTypedef enumType : proto.getEnumTypesList()) g.addEnumeration(NcStream.decodeEnumTypedef(enumType)); for (NcStreamProto.Variable var : proto.getVarsList()) g.addVariable(NcStream.decodeVar(ncfile, g, null, var)); for (NcStreamProto.Structure s : proto.getStructsList()) g.addVariable(NcStream.decodeStructure(ncfile, g, null, s)); for (NcStreamProto.Group gp : proto.getGroupsList()) { Group ng = new Group(ncfile, g, gp.getName()); g.addGroup(ng); readGroup(gp, ncfile, ng); } }
static void readGroup(NcStreamProto.Group proto, NetcdfFile ncfile, Group g) throws InvalidProtocolBufferException { for (NcStreamProto.Dimension dim : proto.getDimsList()) g.addDimension(NcStream.decodeDim(dim)); for (NcStreamProto.Attribute att : proto.getAttsList()) g.addAttribute(NcStream.decodeAtt(att)); for (NcStreamProto.EnumTypedef enumType : proto.getEnumTypesList()) g.addEnumeration(NcStream.decodeEnumTypedef(enumType)); for (NcStreamProto.Variable var : proto.getVarsList()) g.addVariable(NcStream.decodeVar(ncfile, g, null, var)); for (NcStreamProto.Structure s : proto.getStructsList()) g.addVariable(NcStream.decodeStructure(ncfile, g, null, s)); for (NcStreamProto.Group gp : proto.getGroupsList()) { Group ng = new Group(ncfile, g, gp.getName()); g.addGroup(ng); readGroup(gp, ncfile, ng); } }