Select to view content in your preferred language

ArcGRID format to ASCII

1681
2
12-03-2011 05:21 PM
Naga_RaghuveerModala
Emerging Contributor
Hi,
     Can anyone tell me why the size of a ArcGID file when converted to ASCI increased by almost 4 times. I converted a 8GB ArcGrid file to ASCI file which is almost 37GB. Can any one tell me the reason ? Is there any thing i can do to reduce its size ?
0 Kudos
2 Replies
VinceAngelo
Esri Esteemed Contributor
The Grid format is binary, and uses compression, while ASCII isn't binary and doesn't.  If the increase
is only 4x, it's only because the range of values in the grid is rather small -- I'd expect a larger increase
in storage with a wider range of values.

There isn't really any way to make an ASCII raster smaller than binary -- even without compression
coming into play, rasters that store in a byte are going to require, on average, 3.57 bytes in ASCII
(0-9 use two bytes [with spaces], 10-99 use 3, and 100-255 use 4).  The grid format uses compression
on four-byte integer or floating-point values, so a grid is already 2x or 4x larger than a GeoTIFF that
supports 1- and 2-byte integers. Once you start transcribing into ASCII, you've got the separator space
plus 1-11 digits (with the negitive ranges) for integers and 2 characters left of the decimal, the decimal,
and 6-8 characters to the right, and then "e" a sign character and to two digits for the exponent
(~15 characters for each 4-byte uncompressed float).  Compression usually achieves ~40-60% savings,
so the worst case expansion is on the order of 10-12x.  It that light, 4x doesn't look so bad.

If you want to reduce the storage, you'll need to look at a raster format that supports smaller pixel depth
and lossless compression.  The lossy compression formats (JPEG, MrSID, JP2K) achieve high compression
at the cost of precise reproduction of the source data.

- V
0 Kudos
DerekRyter
Deactivated User
I build a lot of ascii grids and found that the number precision makes a big difference in the storage space for ascii grids. For a float grid Arc will automatically fill up an 8-character space in the ascii grid. I round off the values before exporting by multiplying the float grid by the number of decimal places, then converting it to an integer grid, then dividing it by the initial value. The following is a python script to do just that on an interpolated grid of precipitation (ras_out_ppt) for one day (str_day), and stored in the folder in the string variable grid_path_str.

arcpy.RasterToASCII_conversion((Float(Int(ras_out_ppt * 1000)) / 1000), grid_path_str + str_date)
0 Kudos