[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20010606: question about Java netcdf reading performance



> > Two questions for you:
> >
> > 1. In the new version of the library, what is the proper way to read
> > Variable data?  In the previous version, I got a Variable object and
> > called toArray() to grab the data for a variable.  Is this still the
> > same, or is there a better way to grab large datasets in a high
> > performance way?
>
> Here's an example fragment of how to read variable data in the version
> 2 interface:
>
>     try {
>       NetcdfFile nc = new NetcdfFile(fileName); // open it readonly
>       Variable v = nc.findVariable(varName);    // get variable by name
>       Array varMa = v.read();
>         ...
>     }

copyout() in the version 1 library will give similar performance to the code
above. toArray() will add an extra data copy.

it will be much slower if you call Variable.getDouble(), which will read
only one number from the file at a time. This is no longer possible in the
version 2 library.