/[MITgcm]/MITgcm/utils/matlab/stats.m
ViewVC logotype

Annotation of /MITgcm/utils/matlab/stats.m

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


Revision 1.2 - (hide annotations) (download)
Tue May 29 14:01:41 2001 UTC (22 years, 11 months ago) by adcroft
Branch: MAIN
CVS Tags: checkpoint44e_post, release1_p13_pre, checkpoint44f_post, checkpoint43a-release1mods, release1_p13, checkpoint40pre3, checkpoint40pre1, checkpoint40pre7, checkpoint40pre6, checkpoint40pre9, checkpoint40pre8, chkpt44d_post, release1_p8, release1_p9, release1_p1, release1_p2, release1_p3, release1_p4, release1_p5, release1_p6, release1_p7, checkpoint44e_pre, release1_b1, checkpoint43, release1_chkpt44d_post, icebear5, icebear4, icebear3, icebear2, checkpoint40pre2, release1-branch_tutorials, chkpt44a_post, checkpoint44h_pre, checkpoint40pre4, chkpt44c_pre, checkpoint45a_post, ecco_c44_e19, ecco_c44_e18, ecco_c44_e17, ecco_c44_e16, release1_p12, release1_p10, release1_p11, release1_p16, release1_p17, release1_p14, release1_p15, checkpoint44g_post, checkpoint45b_post, release1-branch-end, release1_final_v1, checkpoint44b_post, checkpoint45c_post, ecco_ice2, ecco_ice1, checkpoint44h_post, release1_p12_pre, ecco_c44_e22, ecco_c44_e25, checkpoint40pre5, chkpt44a_pre, ecco_c44_e23, ecco_c44_e20, ecco_c44_e21, ecco_c44_e26, ecco_c44_e27, ecco_c44_e24, ecco-branch-mod1, ecco-branch-mod2, ecco-branch-mod3, ecco-branch-mod4, ecco-branch-mod5, release1_beta1, checkpoint44b_pre, checkpoint42, checkpoint40, checkpoint41, checkpoint44, checkpoint45, chkpt44c_post, checkpoint44f_pre, release1-branch_branchpoint
Branch point for: c24_e25_ice, release1_final, release1-branch, release1, ecco-branch, release1_50yr, icebear, release1_coupled
Changes since 1.1: +50 -0 lines
Merge from branch pre38:
 o essential mods for cubed sphere
 o debugged atmosphere, dynamcis + physics (aim)
 o new packages (mom_vecinv, mom_fluxform, ...)

1 adcroft 1.2 function [varargout] = stats(A)
2     % stats(A) writes the basic statistics of the A to the terminal which
3     % are i) the minimum finite value
4     % ii) the maximum finite value
5     % iii) the mean of the finite values
6     % iv) the S.D. of the finite values ( RMS of [A-mean] )
7     % v) the fraction of non-finite elements excluded from calculations
8     %
9     % e.g.
10     % >> stats(topo)
11     % Min -4555 Max 0 Mean -2331.07 SD 1207.3441 N-Z 1024/1024
12     %
13     % [Min Max Mean SD]=stats(topo); returns the statistics in Min, Max,
14     % Mean and SD and does not write to the terminal.
15     %
16     % $Header: /u/gcmpack/models/MITgcmUV/utils/matlab/Attic/stats.m,v 1.1.2.1 2001/04/13 18:28:23 adcroft Exp $
17    
18     %ii=find(A~=0);
19     ii=find(isfinite(A));
20     if isempty(ii)
21     ii=1;
22     end
23     sZ=prod(size(A));
24     minA=min(A(ii));
25     maxA=max(A(ii));
26     meanA=mean(A(ii));
27     sdA=sqrt( mean( (A(ii)-meanA).^2 ) );
28     nZ=prod(sum(sum(sum(~isfinite(A)))));
29     switch max(nargout)
30     case {0}
31     disp( ...
32     sprintf('Min %0.5g Max %0.5g Mean %0.5g SD %0.5g NaN %i/%i',...
33     minA,maxA,meanA,sdA,nZ,sZ) );
34     case {1}
35     varargout(1)={minA};
36     case {2}
37     varargout(1)={minA};
38     varargout(2)={maxA};
39     case {3}
40     varargout(1)={minA};
41     varargout(2)={maxA};
42     varargout(3)={meanA};
43     case {4}
44     varargout(1)={minA};
45     varargout(2)={maxA};
46     varargout(3)={meanA};
47     varargout(4)={sdA};
48     otherwise
49     error('Too many return arguments requested')
50     end

  ViewVC Help
Powered by ViewVC 1.1.22