<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><p class="MsoNormal">Dear Even and GDAL community<o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal">Thanks for the feedback. 
<o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal"> After receiving your
email I tried to narrow down the source of the problem.  On further investigation it seems like indeed,
like you,  writing to my local disk is quick.  I notice, however,  the problem occurs when writing to file shares
 on a local area network.  The remote file shares where the underlying
file system is UNIX  seems to cause the
problem i.e. writing an image (128,4000,128) using <span style="font-size: 12pt;"> SaveArray(img,remote system
,’ENVI’) </span><span style="font-size: 12pt;">from my Windows system to remote
file share(where the file system is UNIX) takes 3-4 minutes. Writing the image </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">between the same systems to GeoTiff format
appears to be quicker ~24 second. Using the ndarray.tofile() to write the same
image from the same system to the same remote disk takes ~20 seconds.</span><span style="font-size: 12pt;">  </span><span style="font-size: 12pt;">Copying the same size image between the two
systems using Explorer takes only a few seconds. </span><span style="font-size: 12pt;">  </span><span style="font-size: 12pt;">Using </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">the SaveArray(img,remote system ,’ENVI’) </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">operation
to write the image to </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">a remote Windows file
share on the same network </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">takes </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">a </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;"> </span><span style="font-size: 12pt;">few seconds.</span><span style="font-size: 12pt;"> </span></p><p class="MsoNormal"><o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal">Any thoughts as to why this is happening and whether there
is a way of overcoming this problem would be welcomed.<o:p></o:p></p>

<p class="MsoNormal"><o:p> </o:p></p>

<p class="MsoNormal">Thanks <o:p></o:p></p>

<p class="MsoNormal">mike   <o:p></o:p></p><br><div>> From: even.rouault@spatialys.com<br>> To: gdal-dev@lists.osgeo.org<br>> Subject: Re: [gdal-dev] Why is saving an array to ENVI file format using SaveArray so slow?<br>> Date: Fri, 24 Jul 2015 21:31:30 +0200<br>> CC: mikec7200@hotmail.com<br>> <br>> Mike,<br>> <br>> I've tried the following snippet:<br>> <br>> from osgeo import gdal, gdalnumeric<br>> import numpy<br>> <br>> ar = numpy.zeros( [128,4000,128], dtype = numpy.float32)<br>> gdalnumeric.SaveArray(ar,'testenvi.bin','ENVI')<br>> gdalnumeric.SaveArray(ar,'testtif.tif','GTiff')<br>> <br>> And it runs in ~ 2 seconds on both GDAL 1.11 and trunk. (Linux 64bit, but I'm <br>> not sure why the OS would account for such a dramatic difference)<br>> <br>> Even<br>> <br>> > Dear GDAL Developers<br>> > <br>> > <br>> > <br>> > I’m  finding that when<br>> > saving  a relatively small array (shape =<br>> > 128,4000,128  ie 128 band x 4000 lines x<br>> > 128 columns of float data = 256Mb total)  to a ENVI file format using the<br>> > call:<br>> > <br>> > <br>> > <br>> > gdalnumeric.SaveArray(img,strf_out,'ENVI')<br>> > <br>> > <br>> > <br>> > performance is extremely slow (~260 seconds).  When I save the same array<br>> > to Geotif  format using;<br>> > <br>> > <br>> > <br>> > gdalnumeric.SaveArray(img,strf_out,'GTIFF')<br>> > <br>> > <br>> > <br>> > the operation<br>> > takes  ~24 seconds which is much more<br>> > acceptable.<br>> > <br>> > <br>> > <br>> > I’m currently<br>> > using gdal version 1.11.1 .<br>> > <br>> > <br>> > <br>> > My question to<br>> > the forum is then  -why is there such a<br>> > large discrepancy between the performance of the two operations and is<br>> > there a way to improve the performance when writing an array to  an ENVI<br>> > file format?<br>> > <br>> > <br>> > <br>> > I have tried changing<br>> > the GDAL Cache options but performance doesn’t seem to alter.  When<br>> > profiling the code which saves the array to GeoTIFF format I get the<br>> > output contained in the attached file timing_savearray_GTIFF.txt.  When<br>> > profiling the code which saves the array to ENVI format I get the output<br>> > contained in the attached file timing_savearray_ENVI.txt<br>> > <br>> > <br>> > <br>> > I would like to<br>> > save the data to ENVI file format.  Your<br>> > thoughts on this matter would be appreciated.<br>> > <br>> > <br>> > <br>> > Thanks<br>> > <br>> > <br>> > <br>> > Regards<br>> > <br>> > mike<br>> <br>> -- <br>> Spatialys - Geospatial professional services<br>> http://www.spatialys.com<br></div>                                       </div></body>
</html>