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, MSB
Fields inherited from class noaa.coastwatch.io.EarthDataWriter
info, isCanceled, variables, writeProgress, writeVariableName, writeVariables
-
Constructor Summary
ConstructorDescriptionArcWriter
(EarthDataInfo info, String file) Creates a new binary file from the specified earth data info and file name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addVariable
(DataVariable var) Adds a data variable to the writer.void
flush()
Flushes all unwritten data to the destination.void
setMissing
(Number missing) Sets the missing value.void
setOrder
(int order) Sets the byte order.protected void
writeHeader
(DataVariable var) Writes an Arc header file.Methods inherited from class noaa.coastwatch.io.FloatWriter
convertValue, getDefaultMissing, getTypeMax, getTypeMin, getTypeRange, setRange, setScaling
Methods inherited from class noaa.coastwatch.io.BinaryWriter
byteSwap, close, getBytes, getBytes, setHeader, writeVariable
Methods 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 theEarthDataWriter
method so that only one variable may be present in the variable list. Note that only variables of typeGrid
are accepted; other types are silently ignored.- Overrides:
addVariable
in 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:
setOrder
in classBinaryWriter
- Parameters:
order
- the byte order. The options areHOST
for host byte order,MSB
for most significant byte first andLSB
for 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:
setMissing
in 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 theBinaryWriter
method so that only one variable is ever actually flushed to the destination.- Overrides:
flush
in 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:
writeHeader
in classBinaryWriter
- Parameters:
var
- the data variable to write a header for.- Throws:
IOException
- if an error occurred writing the header data to the file.
-