[gdal-dev] Why is saving an array to ENVI file format using SaveArray so slow?

Even Rouault even.rouault at spatialys.com
Fri Jul 24 12:31:30 PDT 2015


Mike,

I've tried the following snippet:

from osgeo import gdal, gdalnumeric
import numpy

ar = numpy.zeros( [128,4000,128], dtype = numpy.float32)
gdalnumeric.SaveArray(ar,'testenvi.bin','ENVI')
gdalnumeric.SaveArray(ar,'testtif.tif','GTiff')

And it runs in ~ 2 seconds on both GDAL 1.11 and trunk. (Linux 64bit, but I'm 
not sure why the OS would account for such a dramatic difference)

Even

> Dear GDAL Developers
> 
> 
> 
> I’m  finding that when
> saving  a relatively small array (shape =
> 128,4000,128  ie 128 band x 4000 lines x
> 128 columns of float data = 256Mb total)  to a ENVI file format using the
> call:
> 
> 
> 
> gdalnumeric.SaveArray(img,strf_out,'ENVI')
> 
> 
> 
> performance is extremely slow (~260 seconds).  When I save the same array
> to Geotif  format using;
> 
> 
> 
> gdalnumeric.SaveArray(img,strf_out,'GTIFF')
> 
> 
> 
> the operation
> takes  ~24 seconds which is much more
> acceptable.
> 
> 
> 
> I’m currently
> using gdal version 1.11.1 .
> 
> 
> 
> My question to
> the forum is then  -why is there such a
> large discrepancy between the performance of the two operations and is
> there a way to improve the performance when writing an array to  an ENVI
> file format?
> 
> 
> 
> I have tried changing
> the GDAL Cache options but performance doesn’t seem to alter.  When
> profiling the code which saves the array to GeoTIFF format I get the
> output contained in the attached file timing_savearray_GTIFF.txt.  When
> profiling the code which saves the array to ENVI format I get the output
> contained in the attached file timing_savearray_ENVI.txt
> 
> 
> 
> I would like to
> save the data to ENVI file format.  Your
> thoughts on this matter would be appreciated.
> 
> 
> 
> Thanks
> 
> 
> 
> Regards
> 
> mike

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list