/[MITgcm]/MITgcm_contrib/gael/comm/course-idma2016/matlab/idma_box_mean.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/comm/course-idma2016/matlab/idma_box_mean.m

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


Revision 1.1 - (hide annotations) (download)
Fri Jan 8 05:05:17 2016 UTC (9 years, 6 months ago) by gforget
Branch: MAIN
- idma_float_plot.m: switch to 4900828 etc
- idma_box_subset.m (new): extact profiles in a geographic area (box)
- idma_box_mean.m (new): build monthly time series of box averages

1 gforget 1.1
2     tmp0=prof_T; tmp0.prof(prof_Tweight.prof==0)=NaN;
3     kk=2;
4    
5     nr=prof_T.nr;
6     tmp_nb=NaN*zeros(240,nr);
7     tmp_mean=NaN*zeros(240,nr);
8     tmp_median=NaN*zeros(240,nr);
9     tmp_std=NaN*zeros(240,nr);
10     for yy=1992:2011;
11     for mm=1:12;
12     dd=[datenum(yy,mm,0) datenum(yy,mm+1,0)];
13     tt=(yy-1992)*12+mm;
14     %
15     tmp1=MITprof_subset(tmp0,'date',dd);
16     tmp1=tmp1.prof;
17     %
18     tmp_nb(tt,:)=sum(~isnan(tmp1),1);
19     tmp_mean(tt,:)=nanmean(tmp1,1);
20     tmp_median(tt,:)=nanmedian(tmp1,1);
21     tmp_std(tt,:)=nanstd(tmp1,1);
22     %
23     end;
24     end;
25    
26     figure;
27     tim=1992+[0.5:239.5]/12;
28     subplot(3,1,1); plot(tim,tmp_nb(:,kk));
29     legend('sample size','Location','NorthWest');
30     subplot(3,1,2); plot(tim,tmp_mean(:,kk)); ylabel('degree C');
31     hold on; plot(tim,tmp_median(:,kk),'r');
32     legend('sample mean','sample median','Location','NorthWest');
33     subplot(3,1,3); plot(tim,tmp_std(:,kk)); ylabel('degree C');
34     legend('sample std','Location','NorthWest');
35    

  ViewVC Help
Powered by ViewVC 1.1.22