/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_misc/runmean.m
ViewVC logotype

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_misc/runmean.m

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

revision 1.2 by gforget, Thu Jun 23 19:02:48 2011 UTC revision 1.3 by gforget, Fri Jul 8 12:58:14 2011 UTC
# Line 52  fldCnt=0*fldIn; Line 52  fldCnt=0*fldIn;
52  %apply the running mean  %apply the running mean
53  fldOut=zeros(sizeCur);  fldOut=zeros(sizeCur);
54  for tcur=-halfWindow:halfWindow  for tcur=-halfWindow:halfWindow
55        %To have halfWindow*2 coeffs rather than halfWindow*2+1, centered to the current
56        %point, it is convenient to reduce the weight of the farthest points to 1/2.
57        %This became necessary to get proper annual means, from monthly data, with halfWindow=6.
58        if abs(tcur)==halfWindow; fac=1/2; else; fac=1; end;
59      tmp1=circshift(fldIn,[tcur zeros(1,length(sizeCur)-1)]);      tmp1=circshift(fldIn,[tcur zeros(1,length(sizeCur)-1)]);
60      fldOut=fldOut+tmp1;      fldOut=fldOut+fac*tmp1;
61      tmp1=circshift(fldMsk,[tcur zeros(1,length(sizeCur)-1)]);      tmp1=circshift(fldMsk,[tcur zeros(1,length(sizeCur)-1)]);
62      fldCnt=fldCnt+tmp1;      fldCnt=fldCnt+fac*tmp1;
63  end  end
64    
65  fldCnt(fldCnt==0)=NaN;  fldCnt(fldCnt==0)=NaN;

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22