Hi Philippe:
The most efficient solution:
Array data = v.read();
float[] fdata =(float []) data.get1DJavaArray(float.class);
this avoids copying if the data is already float.
However, you have a 1D array, not 2D. Since you are worried about efficiency,
the fastest thing to do is to work with the 1D array (ie dont use a 2D array),
and do the stride arithmetic yourself, so use fdata[j*nx+i] whenever you want
f[j][i], where nx = data.getShape()[1]. Im assuming you know these are 2D
arrays.
otherwise you have to allocate the 2D array and copy into it, in which case you
might as well do
Index ima = data.getIndex();
int [] shape = data.getShape();
for (int j = 0; j<shape[0]; j++)
for (int i = 0; i<shape[1]; i++)
f[j][i] = data.getFloat( ima.set(j,i));
Regards,
John
Ticket Details
==================
Ticket ID: SCH-111122
Department: Support netCDF Java
Priority: Normal
Status: Open