%% Test for the netcdf4 java libary and thredds java opendap on a netcdf4 file
%% Use: Matlab 2010a and lower, using netcdf java library through snctools
%% (http://mexcdf.sourceforge.net/)

if strcmpi(version('-release'),'2010b')
   error('This is a test for the netcdf4 java libary and thredds java opendap on a netcdf4 file: use matlab 2010a or lower.')
end

nc       = '170000.00_620000.00_multibeam_data.nc';
nc       = '170000.00_612500.00_multibeam_data.nc';
baseUrl2 = 'http://opendap.deltares.nl/thredds/dodsC/opendap/test/';      % CRASH: [Version 4.2.5 - 20110302.2315]
baseUrl1 = 'http://dtvirt5.deltares.nl:8080/thredds/dodsC/opendap/test/'; % OK:    [Version 4.1.20100722.1952 - 20100722.1952]
baseDir  = 'D:\opendap.deltares.nl\thredds\rijkswaterstaat\vaklodingen\unfilled\';

%%
javarmpath('d:\checkout\OpenEarthTools\matlab\io\netcdf\netcdfAll-4.1.jar')
javarmpath('d:\checkout\OpenEarthTools\matlab\io\netcdf\netcdfAll-4.2.jar')

disp('-CLIENT-------------------------------SOURCE-----------------------------------')
%% client: netcdfAll-4.2
javaaddpath('d:\checkout\OpenEarthTools\matlab\io\netcdf\netcdfAll-4.1.jar')
%% CRASH: source: java opendap [Version 4.2.5 - 20110302.2315]
disp('-netcdfAll-4.1------------------------java 4.2 opendap-------------------------')
nc_dump([baseUrl2,nc],'x');
%% OK:    source: java opendap [Version 4.1.20100722.1952 - 20100722.1952]
disp('-netcdfAll-4.1------------------------java 4.1 opendap-------------------------')
nc_dump([baseUrl1,nc],'x');
%% OK:    source: java 4.1 local
disp('-netcdfAll-4.1------------------------java 4.1 local---------------------------')
nc_dump([baseDir,nc],'x');
javarmpath('d:\checkout\OpenEarthTools\matlab\io\netcdf\netcdfAll-4.1.jar')

%% client: netcdfAll-4.1
javaaddpath('d:\checkout\OpenEarthTools\matlab\io\netcdf\netcdfAll-4.2.jar')
%% CRASH: source: java opendap [Version 4.2.5 - 20110302.2315]
disp('-netcdfAll-4.2------------------------java 4.2 opendap-------------------------')
nc_dump([baseUrl2,nc],'x');
%% OK:    source: java opendap [Version 4.1.20100722.1952 - 20100722.1952]
disp('-netcdfAll-4.2------------------------java 4.1 opendap-------------------------')
nc_dump([baseUrl1,nc],'x');
%% OK:    source: java 4.2 local
disp('-netcdfAll-4.2------------------------java 4.2 local---------------------------')
nc_dump([baseDir,nc],'x');
