%KUSTLIDAR_LIST_GRIDS_TEST   test results from kustlidar_list_grids.py
%
%See also: 

% the files are internally zipped, therefore remote processing is rather slow: 
% data transfer of multiple GB required. The total size of the local files is < 500Mb.

url    = 'http://dtvirt5.deltares.nl:8080/thredds/catalog/opendap/rijkswaterstaat/kustlidar/catalog.xml';
url    = 'f:\checkouts\OpenEarthRawData\rijkswaterstaat\kustlidar\processed\';
png    = 'f:\checkouts\OpenEarthRawData\rijkswaterstaat\kustlidar\png\';
stride = 3;

list   = opendap_catalog(url);

for i=1:length(list)

   disp(num2str(i,'%0.4d'))

   nc  = list{i};

   tmp = nc_getvarinfo(nc,'z');
   nt  = tmp.Size(1);
   %ny  = tmp.Size(2);
   %nx  = tmp.Size(3);
   
   t   = nc_cf_time(nc);
   x   = nc_varget (nc,'x',0,-1,stride);
   y   = nc_varget (nc,'y',0,-1,stride); 
   
   for it=1:nt
   
   disp(['    ',num2str(it,'%0.4d')])
   
      z   = nc_varget (nc,'z',[it-1 0 0],[1 -1 -1],[1 stride stride]);
   
      pcolorcorcen(x(:),y(:),z)
   
      axis([x(1) x(end) y(end) y(1) ])
   
      title(datestr(t(it)))
      tickmap('xy','format','%0.1f')
      grid on
      
      caxis([-10 10])
      colormap(colormapbathymetry(500))
      colorbarwithvtext('z [m]')
      
      print2screensizeoverwrite([png filesep filename(nc) '_' num2str(year(t(it))) '.png'])
      
      pausedisp
      
   end   
   
end   