Float to Raster (Conversion)
Summary
Converts a file of binary floating-point values representing raster data to a raster dataset.
Usage
-
The input file is an IEEE floating-point format, 32-bit signed binary file.
-
Two inputs are required: the binary floating-point file with a .flt extension (<in_float_file>.flt) and an ASCII header file with a .hdr extension (<in_float_file>.hdr). You only specify the .flt file; however, there needs to be an existing .hdr file in the same directory with the same file name.
-
The ASCII file consists of header information containing a set of keywords.
There are two variations of the structure of the ASCII file. One identifies the origin by the coordinates of the lower left corner of the lower left cell, or as the center of the lower left cell.
The format of the file in general is:
NCOLS xxx NROWS xxx XLLCORNER xxx YLLCORNER xxx CELLSIZE xxx NODATA_VALUE xxx BYTEORDER <MSBFIRST | LSBFIRST>
The definitions of the keywords are as follows:
NCOLS and NROWS are the number of columns and rows in the raster defined by the binary file.
XLLCORNER and XLLCORNER are the coordinates of the lower left corner of the lower left cell.
You can also use XLLCENTER and XLLCENTER to specify the origin by the coordinates of the center of the lower left cell.
CELLSIZE is the cell size of the raster.
NODATA_VALUE is the value that is to represent NoData cells.
BYTEORDER represents how multibyte binary numbers are stored on the system on which the binary file was generated. On Intel-based systems, the byte order is LSBFIRST (also known as Big Endian). On most other architectures (all UNIX systems except Alpha, and older Macintosh with Motorola CPUs), the byte order is MSBFIRST (also known as Little Endian).
-
The NODATA_VALUE is the value in the input file that determines which cells should be assigned the value of NoData in the output raster. NoData is normally reserved for those cells whose true value is unknown.
-
In a floating-point binary file, the values are written as binary 32-bit signed floating-point numbers. The first record of the file corresponds to the first row of the raster. Going from left to right, the first 32 bits are the first cell, the next 32 bits are the second cell, and so on, to the end of the record (row). This is repeated for the second record (the second row of the raster) and all the way until the last record (the bottom row of the raster).
-
This tool supports both the lower left corner and the center of the lower left cell for determining the origin. Raster to Float only writes the origin as the lower left corner of the lower left cell.
Syntax
Parameter | Explanation | Data Type |
in_float_file |
The input floating-point binary file. The file must have a .flt extension. There must be a header file in association with the floating-point binary file, with a .hdr extension. | File |
out_raster | The output raster dataset to be created. When not saving to a geodatabase, specify .tif for a TIFF file format, .img for an ERDAS IMAGINE file format, or no extension for a GRID raster format. | Raster Dataset |
Code Sample
Converts a file of binary floating-point values representing raster data to a raster dataset.
import arcpy arcpy.FloatToRaster_conversion("c:/data/elevation.flt", "c:/output/elev")
Converts a file of binary floating-point values representing raster data to a raster dataset.
# Name: FloatToRaster_Ex_02.py # Description: Converts a file of binary floating-point values representing # raster data to a raster dataset. # Requirements: None # Import system modules import arcpy # Set local variables inASCII = "c:/data/elevation.flt" outRaster = "c:/output/elev02" # Execute FloatToRaster arcpy.FloatToRaster_conversion("c:/data/elevation.flt", "c:/output/elev02")