cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public Structure addCopyOfStructure(Group g, @Nonnull Structure original, String shortName, List<Dimension> dims) {
    if (!defineMode)
      throw new UnsupportedOperationException("not in define mode");
    if (original == null)
      throw new NullPointerException("Original structure must be non-null");

    shortName = makeValidObjectName(shortName);
    if (!version.isExtendedModel())
      throw new IllegalArgumentException("Structure type only supported in extended model, version="+version);

    Structure s = new Structure(ncfile, g, null, shortName);
    s.setDimensions(dims);

    for (Variable m : original.getVariables()) {  // LOOK no nested structs
      Variable nest = new Variable(ncfile, g, s, m.getShortName());
      nest.setDataType(m.getDataType());
      nest.setDimensions(m.getDimensions());
      nest.addAll(m.getAttributes());
      s.addMemberVariable(nest);
    }

    ncfile.addVariable(g, s);
    return s;
  }
public Structure addCopyOfStructure(Group g, @Nonnull Structure original, String shortName, List<Dimension> dims) {
    if (!defineMode)
      throw new UnsupportedOperationException("not in define mode");
    if (original == null)
      throw new NullPointerException("Original structure must be non-null");

    shortName = makeValidObjectName(shortName);
    if (!version.isExtendedModel())
      throw new IllegalArgumentException("Structure type only supported in extended model, version="+version);

    Structure s = new Structure(ncfile, g, null, shortName);
    s.setDimensions(dims);

    for (Variable m : original.getVariables()) {  // LOOK no nested structs
      Variable nest = new Variable(ncfile, g, s, m.getShortName());
      nest.setDataType(m.getDataType());
      nest.setDimensions(m.getDimensions());
      nest.addAll(m.getAttributes());
      s.addMemberVariable(nest);
    }

    ncfile.addVariable(g, s);
    return s;
  }
public Structure addCopyOfStructure ( Group g , @ Nonnull Structure original , String shortName , List < Dimension > dims ) { if ( ! defineMode ) throw new UnsupportedOperationException ( "not in define mode" ) ; if ( original == null ) throw new NullPointerException ( "Original structure must be non-null" ) ; shortName = makeValidObjectName ( shortName ) ; if ( ! version . isExtendedModel ( ) ) throw new IllegalArgumentException ( "Structure type only supported in extended model, version=" + version ) ; Structure s = new Structure ( ncfile , g , null , shortName ) ; s . setDimensions ( dims ) ; for ( Variable m : original . getVariables ( ) ) { // LOOK no nested structs
 Variable nest = new Variable ( ncfile , g , s , m . getShortName ( ) ) ; nest . setDataType ( m . getDataType ( ) ) ; nest . setDimensions ( m . getDimensions ( ) ) ; nest . addAll ( m . getAttributes ( ) ) ; s . addMemberVariable ( nest ) ; } ncfile . addVariable ( g , s ) ; return s ; }
Adds a copy of the specified structure to the file (netcdf4 only). DO NOT USE YET

@param g         add to this group in the new file
@param original  the structure to make a copy of in the new file.
@param shortName name of Variable, must be unique with the file.
@param dims      list of Dimensions for the variable in the new file, must already have been added.
Use a list of length 0 for a scalar variable.
@return the Structure variable that has been added
Adds a copy of the specified structure to the file ( netcdf4 only ) . DO NOT USE YET