- To: William Ruddick <ruddick@xxxxxxxxxxxx>
- Subject: Re: NetCDF Array to Java byte array, speed issue
- From: John Caron <caron@xxxxxxxxxxxxxxxx>
- Date: Fri, 25 Oct 2002 19:43:19 -0600
theres not much else to do to speed up the read for now. we will rewrite the
library using the java.nio package sometime in the future; preliminary tests
suggest we will get a factor of 2 speedup.
you can extract the byte array through: byte[] data = (byte[]) fullA.getStorage(); William Ruddick wrote:
John / Support -I have a huge 5120x5120 byte array representing a Sataelite image, that I am reading out of a NetCDF file using theNetCDF Java Libraries v.2.It is taking me an average of 10 seconds on a P2 233 Windows 200 machine with 512M ram.I believe this is taking twice as long as it should be. Do you have any suggestions?My code is a follows:////////////////////////////////// fullimagebytes = new byte[(int)5120*5120]; ucar.nc2.Variable lVar = cdfFile.findVariable("image");ucar.ma2.Array fullA = lVar.read(); // This statement takes on average 5 secondsucar.ma2.IndexIterator iter = fullA.getIndexIteratorFast(); int xi = 0; while (iter.hasNext()) { // This loop takes another 5 seconds on averagefullimagebytes[xi] = iter.getByteNext(); xi++;} //////////////////////////////////I believe there should be some way to go directly from a ucar.nc2.Variable to a primitive byte array in 5 seconds or less.Thanks,NOAA International Division - FX-Net -William Ruddick ruddick@xxxxxxxxxxxx <mailto:ruddick@xxxxxxxxxxxx> 303-497-6757