Class ArcWriter


public class ArcWriter extends FloatWriter
An Arc writer is a float writer that writes a binary format file for input to ArcView or ArcInfo as a binary grid. An optional header file may also be created to specify the earth location and other parameters. The Arc writer limits the functionality of the float writer in order to write files compatible with Arc. Only one variable per grid file is allowed, and the variable must have two dimensions and a map projection.
Since:
3.1.0
Author:
Mark Robinson
  • Constructor Details

  • Method Details

    • addVariable

      public void addVariable(DataVariable var)
      Adds a data variable to the writer. This method overrides the EarthDataWriter method so that only one variable may be present in the variable list. Note that only variables of type Grid are accepted; other types are silently ignored.
      Overrides:
      addVariable in class EarthDataWriter
      Parameters:
      var - the data variable to add.
      See Also:
    • setOrder

      public void setOrder(int order)
      Sets the byte order. This method overrides the super class and simply sets the byte order to MSB.
      Overrides:
      setOrder in class BinaryWriter
      Parameters:
      order - the byte order. The options are HOST for host byte order, MSB for most significant byte first and LSB for least significant byte first.
    • setMissing

      public void setMissing(Number missing)
      Sets the missing value. This method overrides the super class and simply sets the missing value to -3.4e38.
      Overrides:
      setMissing in class BinaryWriter
      Parameters:
      missing - the missing value. The missing value is used to represent missing or out of range data. If null, the missing value is set to the default.
    • flush

      public void flush() throws IOException
      Flushes all unwritten data to the destination. This method overrides the BinaryWriter method so that only one variable is ever actually flushed to the destination.
      Overrides:
      flush in class BinaryWriter
      Throws:
      IOException - if the data destination had I/O errors.
    • writeHeader

      protected void writeHeader(DataVariable var) throws IOException
      Writes an Arc header file. The header is a text file with a number of lines as follows:
         nrows (number of data rows)
         ncols (number of data columns)
         xllcorner (lower left corner x coordinate in map coordinates)
         yllcorner (lower left corner y coordinate in map coordinates)
         cellsize (size of each grid cell in map coordinates)
         nodata_value (missing data value)
         byteorder (byte order as "LSBFIRST" or "MSBFIRST")
         nbits 32
       
      The name of the header file is derived from the output file name by replacing any '.' followed by an extension with '.hdr'.
      Overrides:
      writeHeader in class BinaryWriter
      Parameters:
      var - the data variable to write a header for.
      Throws:
      IOException - if an error occurred writing the header data to the file.