/[MITgcm]/MITgcm_contrib/gael/matlab_class/sample_processing/example_smooth.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/sample_processing/example_smooth.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (hide annotations) (download)
Wed Aug 1 00:28:15 2012 UTC (12 years, 11 months ago) by gforget
Branch: MAIN
Changes since 1.2: +29 -2 lines
- added demo of diffsmoth2Drotated : apply anisotropic smoothing operator
  that acts preferentially along contours of a reference field (here latitude).

1 gforget 1.1
2     %use the field produced in sample_proccessing/example_bin_average.m
3 gforget 1.2 if myenv.verbose>0;
4     gcmfaces_msg('* apply land mask (1/NaN) to gridded before smoothing');
5     end;
6     % fld=obsMap; fld(find(isnan(fld)))=0; fld(find(mygrid.hFacCsurf==0))=NaN;
7     fld=obsMap.*mygrid.mskC(:,:,1);
8 gforget 1.1
9 gforget 1.3 %%%%%%%% isotropic diffusion %%%%%%%%
10    
11 gforget 1.1 %choose smoothing scale: here 3 X grid spacing
12 gforget 1.2 if myenv.verbose>0;
13     gcmfaces_msg('* set the smoothing scale to 3 grid points');
14     end;
15 gforget 1.1 distXC=3*mygrid.DXC; distYC=3*mygrid.DYC;
16    
17     %do the smoothing:
18 gforget 1.2 if myenv.verbose>0;
19     gcmfaces_msg(['* call diffsmoth2D : apply smoothing operator ' ...
20     'that consists in time stepping a diffusion equation ' ...
21     'with accordingly chosen diffusivity and duration. In particular ' ...
22     'diffsmoth2D illustrates gradient computations (using calc_T_grad) ' ...
23     'and divergence computations (using calc_UV_div).']);
24     end;
25     obsMap_smooth=diffsmooth2D(fld,distXC,distYC);
26 gforget 1.1
27     %display results:
28 gforget 1.2 if myenv.verbose>0;
29     gcmfaces_msg('* crude display of results in array format');
30     end;
31 gforget 1.1
32 gforget 1.3 figure; qwckplot(obsMap_smooth); caxis([-1 1]*0.4); colorbar;
33 gforget 1.2 title('smoothed data')
34 gforget 1.3
35     %%%%%%%% rotated diffusion %%%%%%%%
36    
37     %choose smoothing scale: here 3 X grid spacing
38     if myenv.verbose>0;
39     gcmfaces_msg('* set anisotropic and rotated smoothing');
40     end;
41     distLarge=3*sqrt(mygrid.RAC); distSmall=1*sqrt(mygrid.RAC);
42     fldRef=mygrid.YC;
43    
44     %do the smoothing:
45     if myenv.verbose>0;
46     gcmfaces_msg(['* call diffsmoth2Drotated : apply anisotropic smoothing operator ' ...
47     'that acts preferentially along contours of a reference field (here latitude).']);
48     end;
49     obsMap_smooth2=diffsmooth2Drotated(fld,distLarge,distSmall,mygrid.YC);
50    
51     %display results:
52     if myenv.verbose>0;
53     gcmfaces_msg('* crude display of results in array format');
54     end;
55    
56     figure; qwckplot(obsMap_smooth2); caxis([-1 1]*0.4); colorbar;
57     title('zonally smoothed data')
58    
59    

  ViewVC Help
Powered by ViewVC 1.1.22