[Dart-dev] DART/branches Revision: 12873

dart at ucar.edu dart at ucar.edu
Mon Oct 1 18:52:21 MDT 2018


thoar at ucar.edu
2018-10-01 18:52:21 -0600 (Mon, 01 Oct 2018)
47
Much better visualization of the DATM fields.




Modified: DART/branches/cesm_clm/models/clm/matlab/CheckDATM.m
===================================================================
--- DART/branches/cesm_clm/models/clm/matlab/CheckDATM.m	2018-10-02 00:48:19 UTC (rev 12872)
+++ DART/branches/cesm_clm/models/clm/matlab/CheckDATM.m	2018-10-02 00:52:21 UTC (rev 12873)
@@ -8,42 +8,178 @@
 %
 % DART $Id$
 
-dirname = '/glade/proj3/DART/CAM_DATM';
+dirname = '/glade/p_old/image/thoar/CAM_DATM/4xdaily';
+dirname = '/glade/collections/rda/data/ds199.1';
 
-% for iyear = [1999 2008 2009 2010]
-for iyear = 2009:2009
-for imem = 1:80
+% 	float a2x6h_Faxa_swndf(time, a2x6h_ny, a2x6h_nx) ;
 
-   filename = sprintf('%s/%d/CAM_DATM-%02d.cpl.ha2x1dx6h.%d.nc', ...
-                      dirname,iyear,imem,iyear);
+if (exist('variance','var') ~= 1)
 
-   if ( exist(filename,'file') ~= 2)
-      error('%s does not exist',filename)
+   ntimes = 1460;
+   a2x6h_ny = 96;
+   a2x6h_nx = 144;
+   members  = 80;
+   tensor = zeros(a2x6h_nx,a2x6h_ny,ntimes,members,'single');
+   
+   % for iyear = [1999 2008 2009 2010]
+   for iyear = 2008:2008
+   for imem = 1:members
+   
+      filename = sprintf('%s/CAM_DATM.cpl_%04d.ha2x1dx6h.%d.nc', ...
+                         dirname,imem,iyear);
+   
+      if ( exist(filename,'file') ~= 2)
+         error('%s does not exist',filename)
+      end
+   
+      times       = ncread(filename,'time');
+   %  timeunits   = ncread(filename,'time','units');
+      ncid        = netcdf.open(filename);
+      varid       = netcdf.inqVarID(ncid,'time');
+      timeunits   = netcdf.getAtt(ncid,varid,'units');
+      netcdf.close(ncid)
+   
+      timebase    = sscanf(timeunits,'%*s%*s%d%*c%d%*c%d'); % YYYY MM DD
+      timeorigin  = datenum(timebase(1),timebase(2),timebase(3));
+      ttimes      = times + timeorigin;
+   
+      ntimes = length(ttimes);
+      deltat = diff(ttimes);
+      delta  = median(deltat);
+      inds   = find(deltat > delta);
+   
+      if ((length(ttimes) == 365*4) && isempty(inds)) 
+         fprintf('%s has all the timesteps.\n',filename)
+      else
+         fprintf('WARNING: %s has %d timesteps, not %d.\n',filename,ntimes,365*4)
+         disp('WARNING: problem occurrs around')
+         datestr(ttimes(inds))
+      end
+   
+   %   a2x6h_Faxa_swndr = ncread(filename,'a2x6h_Faxa_swndr');
+   %   mymin = min(a2x6h_Faxa_swndr(:));
+   %   mymax = max(a2x6h_Faxa_swndr(:));
+   %   fprintf(1,'%04d %04d swndr min %f max %f \n',iyear,imem,mymin,mymax)
+   %
+   %   a2x6h_Faxa_swvdr = ncread(filename,'a2x6h_Faxa_swvdr');
+   %   mymin = min(a2x6h_Faxa_swvdr(:));
+   %   mymax = max(a2x6h_Faxa_swvdr(:));
+   %   fprintf(1,'%04d %04d swvdr min %f max %f \n',iyear,imem,mymin,mymax)
+   %
+   %   a2x6h_Faxa_swndf = ncread(filename,'a2x6h_Faxa_swndf');
+   %   mymin = min(a2x6h_Faxa_swndf(:));
+   %   mymax = max(a2x6h_Faxa_swndf(:));
+   %   fprintf(1,'%04d %04d swndf min %f max %f \n',iyear,imem,mymin,mymax)
+   
+      a2x6h_Faxa_swvdf = ncread(filename,'a2x6h_Faxa_swvdf');
+      mymin = min(a2x6h_Faxa_swvdf(:));
+      mymax = max(a2x6h_Faxa_swvdf(:));
+      fprintf(1,'%04d %04d swvdf min %f max %f \n',iyear,imem,mymin,mymax)
+   
+      tensor(:,:,:,imem) = a2x6h_Faxa_swvdf;
+      clear a2x6h_Faxa_swvdf
+   
    end
+   end
+   
+end
 
-   times       = nc_varget(filename,'time');
-   timeunits   = nc_attget(filename,'time','units');
-   timebase    = sscanf(timeunits,'%*s%*s%d%*c%d%*c%d'); % YYYY MM DD
-   timeorigin  = datenum(timebase(1),timebase(2),timebase(3));
-   ttimes      = times + timeorigin;
+t_interest = [352, 880:1000];
+t_interest = [352];
 
-   ntimes = length(ttimes);


More information about the Dart-dev mailing list