cdm/src/main/java/ucar/nc2/NetcdfFileWriter.java
public void writeStringData(Variable v, int[] origin, Array values) throws java.io.IOException, InvalidRangeException {

    if (values.getElementType() != String.class)
      throw new IllegalArgumentException("Must be ArrayObject of String ");

    if (v.getDataType() != DataType.CHAR)
      throw new IllegalArgumentException("variable " + v.getFullName() + " is not type CHAR");
    int rank = v.getRank();
    int strlen = v.getShape(rank - 1);

    // turn it into an ArrayChar
    ArrayChar cvalues = ArrayChar.makeFromStringArray((ArrayObject) values, strlen);

    int[] corigin = new int[rank];
    System.arraycopy(origin, 0, corigin, 0, rank - 1);

    write(v, corigin, cvalues);
  }
public void writeStringData(Variable v, int[] origin, Array values) throws java.io.IOException, InvalidRangeException {

    if (values.getElementType() != String.class)
      throw new IllegalArgumentException("Must be ArrayObject of String ");

    if (v.getDataType() != DataType.CHAR)
      throw new IllegalArgumentException("variable " + v.getFullName() + " is not type CHAR");
    int rank = v.getRank();
    int strlen = v.getShape(rank - 1);

    // turn it into an ArrayChar
    ArrayChar cvalues = ArrayChar.makeFromStringArray((ArrayObject) values, strlen);

    int[] corigin = new int[rank];
    System.arraycopy(origin, 0, corigin, 0, rank - 1);

    write(v, corigin, cvalues);
  }
public void writeStringData ( Variable v , int [ ] origin , Array values ) throws java . io . IOException , InvalidRangeException { if ( values . getElementType ( ) != String . class ) throw new IllegalArgumentException ( "Must be ArrayObject of String " ) ; if ( v . getDataType ( ) != DataType . CHAR ) throw new IllegalArgumentException ( "variable " + v . getFullName ( ) + " is not type CHAR" ) ; int rank = v . getRank ( ) ; int strlen = v . getShape ( rank - 1 ) ; // turn it into an ArrayChar
 ArrayChar cvalues = ArrayChar . makeFromStringArray ( ( ArrayObject ) values , strlen ) ; int [ ] corigin = new int [ rank ] ; System . arraycopy ( origin , 0 , corigin , 0 , rank - 1 ) ; write ( v , corigin , cvalues ) ; }
Write String data to a CHAR variable. Must not be in define mode.

@param v      variable to write to
@param origin offset to start writing, ignore the strlen dimension.
@param values write this array; must be ArrayObject of String
@throws IOException                    if I/O error
@throws ucar.ma2.InvalidRangeException if values Array has illegal shape
Write String data to a CHAR variable . Must not be in define mode .