----- Original Message -----
From: "Gabriel Taban" <gab_taban@xxxxxxxxx>
To: <netcdf-java@xxxxxxxxxxxxxxxx>
Sent: Friday, June 21, 2002 9:26 AM
Subject: Netcdf Array -- Java Array
> Hi All!
> I have a netcdf file and I would like to read one
> array (it has only one Dimension) and to put the
> numbers in a regular Java Array (int arrayName[] = new
> int[arraySize]).
> I couldn't suceed till now, so I think I need your
> help.
> Thanks,
> Gabriel
try {
NetcdfFile nc = new NetcdfFile(fileName);
/* Read a variable named time */
Variable time = nc.findVariable("time");
Array ma2Array = time.read();
} catch (java.io.IOException e) {
e.printStackTrace();
}
// you need to know its type, else you'll get a cast exception
int [] javaArray = (int []) ma2Array.copyTo1DJavaArray();