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

Contents of /MITgcm_contrib/gael/matlab_class/sample_processing/example_bin_average.m

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


Revision 1.21 - (show annotations) (download)
Mon Jan 25 21:13:56 2016 UTC (9 years, 6 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.20: +3 -2 lines
- add missing titles, units, axes labels

1 function [fld]=example_bin_average();
2 % EXAMPLE_BIN_AVERAGE generates a sample of random
3 % numbers distributed over the globe and
4 % bin averages to the default grid.
5
6 %%%%%%%%%%%%%%%%%
7 %load grid:
8 %%%%%%%%%%%%%%%%%
9
10 gcmfaces_global;
11
12 if isempty(mygrid);
13 grid_load;
14 end;
15
16 if myenv.verbose>0;
17 gcmfaces_msg('===============================================');
18 gcmfaces_msg(['*** entering example_bin_average: generate ' ...
19 'randomly distributed data samples (position and value), ' ...
20 'and bin average this data set to a gcmfaces grid'],'');
21 end;
22
23 warning('off','MATLAB:dsearch:DeprecatedFunction');
24 warning('off','MATLAB:delaunay:DuplicateDataPoints');
25
26 %%%%%%%%%%%%%%%%%%%%%%%
27 %generate random data
28
29 if myenv.verbose>0;
30 gcmfaces_msg('* generate random data');
31 end;
32 nn=1e6;
33 lat=(rand(nn,1)-0.5)*2*90;
34 lon=(rand(nn,1)-0.5)*2*180;
35 %needed for 0-360 longitude convention
36 if mygrid.nFaces==1;
37 xx=find(lon<0);lon(xx)=lon(xx)+360;
38 end;
39 sample=(rand(nn,1)-0.5)*2;
40
41 %%%%%%%%%%%%%%%%%%%%%%%
42 %generate delaunay triangulation
43
44 if myenv.verbose>0;
45 gcmfaces_msg('* call gcmfaces_bindata : generate delaunay triangulation');
46 end;
47 gcmfaces_bindata;
48
49 %%%%%%%%%%%%%%%%%%%%%%%%
50 %bin average random data
51
52 if myenv.verbose>0;
53 gcmfaces_msg('* call gcmfaces_bindata : bin average data');
54 end;
55 fld=gcmfaces_bindata(lon,lat,sample);
56
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %quick display
59 if myenv.verbose>0;
60 gcmfaces_msg('* display results on sphere');
61 end;
62 figureL; set(gca,'FontSize',16);
63 gcmfaces_sphere(fld); axis xy; caxis([-1 1]*0.4); colorbar;
64 title('bin averaged random data');
65
66 if myenv.verbose>0;
67 gcmfaces_msg('*** leaving example_bin_average');
68 gcmfaces_msg('===============================================');
69 end;
70
71
72
73

  ViewVC Help
Powered by ViewVC 1.1.22