Re: [netcdf-java] Problem in Sample data in NetCDF

On Monday 03 September 2007 07:35, Rich Signell wrote:

>
> Roger,
>
> Did you know that SNCTOOLS can read NetCDF files into Matlab using
> NetCDF-Java?  All you have to do is edit "nc_method.m" and change
> "method=mexnc" to "method=java".

This gets a little easier in the next version of SNCTOOLS, 2.4.2, which is 
available as of today.  No more editing of any files, all the user has to do 
to enable the java backend (assuming the jar file is present and added to the 
path via javaaddpath) is to type from the matlab command prompt

        setpref ( 'SNCTOOLS', 'USE_JAVA', true )

A lot changed in 2.4.0, and some user code might break as a result.  If that's 
the case, let me know about it.



>
> At least on the file I tried, using SNCTOOLS "nc_varget" function
>
> (java) is then faster than using the mex-file based "NetCDF toolkit":
> >> tic;a=nc_varget('VS_ele.nc','lon',[0],[2],[2]);toc
>
> Elapsed time is 0.083326 seconds.
>
> >> a
>
> a =
>
>   -72.6249
>   -72.5983
>
> >> tic;nc=netcdf('VS_ele.nc');a=nc{'lon'}(1:2:3);close(nc);toc
>
> Elapsed time is 0.369757 seconds.
>
> >> a
>
> a =
>
>   -72.6249
>   -72.5983
>
> You can explore the "nc_varget_java.m" routine in the SNCTOOLS
> "private" directory to see the NetCDF java routines used.
>
>
> -Rich