clear all
close all

filename=['ecco_radtrans9_size163_interannaul360_2006_formatt.nc'];

ncid1=netcdf.open(filename);

   [ndim,nvar,natt,unlim]=netcdf.inq(ncid1);
     for i=0:ndim-1,
      [dimname, dimlength]=netcdf.inqDim(ncid1,i);
      diml(i+1)=dimlength;
     end % for i

     for i=0:nvar-1;
      [varname, xtype,dimid,natt]=netcdf.inqVar(ncid1,i);
      if (length(dimid)==1),
        eval([varname,'=netcdf.getVar(ncid1,i,0,diml(dimid+1));']);
      end % if
      if (length(dimid)==2),
        eval([varname,'=netcdf.getVar(ncid1,i,[0 0],[diml(dimid(1)+1) diml(dimid(2)+1)] );']);
      end % if
      if (length(dimid)==3),
        eval([varname,'=netcdf.getVar(ncid1,i,[0 0 0],[diml(dimid(1)+1) diml(dimid(2)+1) diml(dimid(3)+1)] );']);
      end % if
      if (length(dimid)==4),
         eval([varname,'=netcdf.getVar(ncid1,i,[0 0 0 0],[diml(dimid(1)+1) diml(dimid(2)+1) diml(dimid(3)+1)  diml(dimid(4)+1)] );']);
       end % if
        eval([varname,'=double(',varname,');']);
     end % for i
   netcdf.close(ncid1);
%%
%%% plot
   figure

   imon=7; monstr='July';

   tmp=squeeze(SST(imon,:,:)); fi=find(tmp==0); tmp(fi)=NaN;
   subplot(2,2,1),  pcolor(longitude,latitude,tmp'); caxis([-2 30]); shading flat, colorbar
   title(['SST, ',monstr]);

   tmp=squeeze(Reflectance(imon,:,:,3)); tmp(fi)=NaN;
   subplot(2,2,3),  pcolor(longitude,latitude,tmp'); caxis([0 .08]); shading flat, colorbar
   title(['Reflectance (450nm), ',monstr]);
 
   tmp=tmp/3.5;
   subplot(2,2,4),  pcolor(longitude,latitude,tmp'); caxis([0 .02]); shading flat, colorbar
   title(['RRS (450nm), ',monstr]);


