ucar.nc2.Group.addGroup()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中ucar.nc2.Group.addGroup()方法的一些代码示例,展示了Group.addGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.addGroup()方法的具体详情如下:
包路径:ucar.nc2.Group
类名称:Group
方法名:addGroup

Group.addGroup介绍

[英]Add a nested Group
[中]添加嵌套组

代码示例

代码示例来源:origin: Unidata/thredds

/**
 * Add a group to the parent group.
 *
 * @param parent add to this group. If group is null, use root group
 * @param g      add this group
 * @return the group that was added
 */
public Group addGroup(Group parent, Group g) {
 if (immutable) throw new IllegalStateException("Cant modify");
 if (parent == null) parent = rootGroup;
 parent.addGroup(g);
 return g;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Add a group to the parent group.
 *
 * @param parent add to this group. If group is null, use root group
 * @param g      add this group
 * @return the group that was added
 */
public Group addGroup(Group parent, Group g) {
 if (immutable) throw new IllegalStateException("Cant modify");
 if (parent == null) parent = rootGroup;
 parent.addGroup(g);
 return g;
}

代码示例来源:origin: edu.ucar/cdm

/**
 * Add a group to the parent group.
 *
 * @param parent add to this group. If group is null, use root group
 * @param g      add this group
 * @return the group that was added
 */
public Group addGroup(Group parent, Group g) {
 if (immutable) throw new IllegalStateException("Cant modify");
 if (parent == null) parent = rootGroup;
 parent.addGroup(g);
 return g;
}

代码示例来源:origin: Unidata/thredds

/**
 * Add a Group to the file. Must be in define mode.
 * If pass in null as the parent then the root group is returned and the name is ignored.
 * This is how you get the root group. Note this is different from other uses of parent group.
 *
 * @param parent the parent of this group, if null then returns the root group.
 * @param name   the name of this group, unique within parent
 * @return the created group
 */
public Group addGroup(Group parent, String name) {
 if (!defineMode) throw new UnsupportedOperationException("not in define mode");
 if (parent == null) return ncfile.getRootGroup();
 Group result = new Group(ncfile, parent, name);
 parent.addGroup(result);
 return result;
}

代码示例来源:origin: edu.ucar/netcdf

/**
 * Add a Group to the file. Must be in define mode.
 * If pass in null as the parent then the root group is returned and the name is ignored. 
 * This is how you get the root group. Note this is different from other uses of parent group.  
 * 
 * @param parent the parent of this group, if null then returns the root group.
 * @param name the name of this group, unique within parent
 * @return the created group
 */
 public Group addGroup(Group parent, String name) {
  if (!defineMode) throw new UnsupportedOperationException("not in define mode");
  if (parent == null) return ncfile.getRootGroup();
  Group result = new Group(ncfile, parent, name);
  parent.addGroup(result);
  return result;
 }

代码示例来源:origin: edu.ucar/cdm

/**
 * Add a Group to the file. Must be in define mode.
 * If pass in null as the parent then the root group is returned and the name is ignored.
 * This is how you get the root group. Note this is different from other uses of parent group.
 *
 * @param parent the parent of this group, if null then returns the root group.
 * @param name   the name of this group, unique within parent
 * @return the created group
 */
public Group addGroup(Group parent, String name) {
 if (!defineMode) throw new UnsupportedOperationException("not in define mode");
 if (parent == null) return ncfile.getRootGroup();
 Group result = new Group(ncfile, parent, name);
 parent.addGroup(result);
 return result;
}

代码示例来源:origin: Unidata/thredds

if (next == null) {
 next = new Group(ncf, current, clearname);
 current.addGroup(next);

代码示例来源:origin: edu.ucar/netcdf

if (next == null) {
 next = new Group(ncf, current, clearname);
 current.addGroup(next);

代码示例来源:origin: edu.ucar/cdm

if (next == null) {
 next = new Group(ncf, current, clearname);
 current.addGroup(next);

代码示例来源:origin: edu.ucar/cdm

private void addGroupToGroup(Group parent, Group g, Tag tag) {
 Group groupExisting = parent.findGroup(g.getShortName());
 if (groupExisting != null) {
  g.setName(g.getShortName() + tag.refno);
 }
 parent.addGroup(g);
}

代码示例来源:origin: Unidata/thredds

private void addGroupToGroup(Group parent, Group g, Tag tag) {
 Group groupExisting = parent.findGroup(g.getShortName());
 if (groupExisting != null) {
  g.setName(g.getShortName() + tag.refno);
 }
 parent.addGroup(g);
}

代码示例来源:origin: edu.ucar/netcdf

private void addGroupToGroup(Group parent, Group g, Tag tag) {
 Group groupExisting = parent.findGroup(g.getShortName());
 if (groupExisting != null) {
  g.setName(g.getShortName() + tag.refno);
 }
 parent.addGroup(g);
}

代码示例来源:origin: Unidata/thredds

throw new IOException(ret + ": " + nc4.nc_strerror(ret));
Group child = new Group(ncfile, g4.g, makeString(name));
g4.g.addGroup(child);
makeGroup(new Group4(group_id, child, g4));

代码示例来源:origin: edu.ucar/netcdf

if (ret != 0) throw new IOException(ret + ": " + nc4.nc_strerror(ret));
Group child = new Group(ncfile, g4.g, makeString(name));
g4.g.addGroup(child);
makeGroup(group_id, new Group4(child, g4));

代码示例来源:origin: edu.ucar/cdm

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);
 }
}

代码示例来源:origin: edu.ucar/netcdf

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);
 }
}

代码示例来源:origin: Unidata/thredds

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);
 }
}

代码示例来源:origin: edu.ucar/netcdf

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);
 }
}

代码示例来源:origin: edu.ucar/cdm

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);
 }
}

代码示例来源:origin: Unidata/thredds

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);
 }
}

相关文章