Package noaa.coastwatch.io
Class ArcWriter
java.lang.Object
noaa.coastwatch.io.EarthDataWriter
noaa.coastwatch.io.BinaryWriter
noaa.coastwatch.io.FloatWriter
noaa.coastwatch.io.ArcWriter
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
-
Field Summary
Fields inherited from class noaa.coastwatch.io.BinaryWriter
DEFAULT_CHUNK_SIZE, HOST, LSB, MSBFields inherited from class noaa.coastwatch.io.EarthDataWriter
info, isCanceled, variables, writeProgress, writeVariableName, writeVariables -
Constructor Summary
ConstructorsConstructorDescriptionArcWriter(EarthDataInfo info, String file) Creates a new binary file from the specified earth data info and file name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddVariable(DataVariable var) Adds a data variable to the writer.voidflush()Flushes all unwritten data to the destination.voidsetMissing(Number missing) Sets the missing value.voidsetOrder(int order) Sets the byte order.protected voidwriteHeader(DataVariable var) Writes an Arc header file.Methods inherited from class noaa.coastwatch.io.FloatWriter
convertValue, getDefaultMissing, getTypeMax, getTypeMin, getTypeRange, setRange, setScalingMethods inherited from class noaa.coastwatch.io.BinaryWriter
byteSwap, close, getBytes, getBytes, setHeader, writeVariableMethods inherited from class noaa.coastwatch.io.EarthDataWriter
cancel, finalize, getDestination, getProgress, getProgressLength, getProgressVariable
-
Constructor Details
-
ArcWriter
Creates a new binary file from the specified earth data info and file name.- Parameters:
info- the earth data info object.file- the new binary file name.- Throws:
IOException- if an error occurred opening the file.- See Also:
-
-
Method Details
-
addVariable
Adds a data variable to the writer. This method overrides theEarthDataWritermethod so that only one variable may be present in the variable list. Note that only variables of typeGridare accepted; other types are silently ignored.- Overrides:
addVariablein classEarthDataWriter- 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 toMSB.- Overrides:
setOrderin classBinaryWriter- Parameters:
order- the byte order. The options areHOSTfor host byte order,MSBfor most significant byte first andLSBfor least significant byte first.
-
setMissing
Sets the missing value. This method overrides the super class and simply sets the missing value to-3.4e38.- Overrides:
setMissingin classBinaryWriter- 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
Flushes all unwritten data to the destination. This method overrides theBinaryWritermethod so that only one variable is ever actually flushed to the destination.- Overrides:
flushin classBinaryWriter- Throws:
IOException- if the data destination had I/O errors.
-
writeHeader
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:
writeHeaderin classBinaryWriter- Parameters:
var- the data variable to write a header for.- Throws:
IOException- if an error occurred writing the header data to the file.
-