// @todo Make sure units are meters
 public Array getElevation(Range range) throws IOException, InvalidRangeException {
   List section = new ArrayList(1);
   section.add(range);
   Array a = elevVar.read(section);
   if (elevVarUnitsConversionFactor == 1.0) return (a);
   for (IndexIterator it = a.getIndexIterator(); it.hasNext(); ) {
     if (elevVar.getDataType() == DataType.DOUBLE) {
       double val = it.getDoubleNext();
       it.setDoubleCurrent(val * elevVarUnitsConversionFactor);
     } else if (elevVar.getDataType() == DataType.FLOAT) {
       float val = it.getFloatNext();
       it.setFloatCurrent((float) (val * elevVarUnitsConversionFactor));
     } else if (elevVar.getDataType() == DataType.INT) {
       int val = it.getIntNext();
       it.setIntCurrent((int) (val * elevVarUnitsConversionFactor));
     } else if (elevVar.getDataType() == DataType.LONG) {
       long val = it.getLongNext();
       it.setLongCurrent((long) (val * elevVarUnitsConversionFactor));
     } else {
       throw new IllegalStateException(
           "Elevation variable type <"
               + elevVar.getDataType().toString()
               + "> not double, float, int, or long.");
     }
   }
   return (a);
 }
  private void writeCoordinateVariable(VariableEntry variable, NetcdfFileWriteable ncFile)
      throws IOException, InvalidRangeException {

    int[] dimensions = {variable.getSize()};
    Array array;

    // so far, everything is a float or an int
    // way too much code duplication but I'm done fightin java for now
    if (variable.getType() == DataType.INT) {
      array = new ArrayInt(dimensions);
      int tempInt = 0;
      IndexIterator iter = array.getIndexIterator();

      while (iter.hasNext()) {
        iter.getIntNext();
        iter.setIntCurrent(tempInt);
        tempInt++;
      }

      ncFile.write(variable.getVariableName(), array);
    } else if (variable.getType() == DataType.FLOAT) {
      array = new ArrayFloat(dimensions);
      float tempFloat = 0;
      IndexIterator iter = array.getIndexIterator();

      while (iter.hasNext()) {
        iter.getFloatNext();
        iter.setFloatCurrent(tempFloat);
        tempFloat++;
      }

      ncFile.write(variable.getVariableName(), array);
    } else if (variable.getType() == DataType.LONG) {
      array = new ArrayLong(dimensions);
      long tempLong = 0;
      IndexIterator iter = array.getIndexIterator();

      while (iter.hasNext()) {
        iter.getLongNext();
        iter.setLongCurrent(tempLong);
        tempLong++;
      }

      ncFile.write(variable.getVariableName(), array);
    }

    // ncFile.write(variable.getVariableName(),array);

  }
  /**
   * Translate missing data to NaNs. Data must be DOUBLE or FLOAT
   *
   * @param in convert this array
   * @return same array, with missing values replaced by NaNs
   */
  private Array convertMissing(Array in) {
    if (debugRead) System.out.println("convertMissing ");

    IndexIterator iterIn = in.getIndexIterator();
    if (in.getElementType() == double.class) {
      while (iterIn.hasNext()) {
        double val = iterIn.getDoubleNext();
        if (isMissing_(val)) iterIn.setDoubleCurrent(Double.NaN);
      }
    } else if (in.getElementType() == float.class) {
      while (iterIn.hasNext()) {
        float val = iterIn.getFloatNext();
        if (isMissing_(val)) iterIn.setFloatCurrent(Float.NaN);
      }
    }
    return in;
  }