/[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.2 - (hide annotations) (download)
Thu Oct 20 21:03:16 2011 UTC (13 years, 9 months ago) by gforget
Branch: MAIN
Changes since 1.1: +22 -6 lines
- example_interp.m : now starts from a 2x2 field.
- example_bin_average.m : now uses gcmfaces_bindata.
- add gcmfaces_msg calls for myenv.verbose>0.
- fix tabs.

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     %choose smoothing scale: here 3 X grid spacing
10 gforget 1.2 if myenv.verbose>0;
11     gcmfaces_msg('* set the smoothing scale to 3 grid points');
12     end;
13 gforget 1.1 distXC=3*mygrid.DXC; distYC=3*mygrid.DYC;
14    
15     %do the smoothing:
16 gforget 1.2 if myenv.verbose>0;
17     gcmfaces_msg(['* call diffsmoth2D : apply smoothing operator ' ...
18     'that consists in time stepping a diffusion equation ' ...
19     'with accordingly chosen diffusivity and duration. In particular ' ...
20     'diffsmoth2D illustrates gradient computations (using calc_T_grad) ' ...
21     'and divergence computations (using calc_UV_div).']);
22     end;
23     obsMap_smooth=diffsmooth2D(fld,distXC,distYC);
24 gforget 1.1
25     %display results:
26 gforget 1.2 if myenv.verbose>0;
27     gcmfaces_msg('* crude display of results in array format');
28     end;
29     OBS_smooth=convert2array(obsMap_smooth);
30 gforget 1.1
31 gforget 1.2 figure; imagescnan(OBS_smooth','nancolor',[1 1 1]*0.8); axis xy; caxis([-1 1]*0.4); colorbar;
32     title('smoothed data')

  ViewVC Help
Powered by ViewVC 1.1.22