/[MITgcm]/MITgcm_contrib/gag_subduction_scripts/cshift.m
ViewVC logotype

Annotation of /MITgcm_contrib/gag_subduction_scripts/cshift.m

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


Revision 1.1 - (hide annotations) (download)
Wed Apr 21 21:12:13 2004 UTC (21 years, 2 months ago) by gebbie
Branch: MAIN
CVS Tags: HEAD
Added some diagnostics for Eulerian maps, and some utilities.

1 gebbie 1.1 function [out] = cshift(in,DIM,shift)
2     %function [out] = cshift(in,DIM,shift)
3     %
4     % Replicate the CSHIFT function in F90 (?).
5     %
6     % G. Gebbie, MIT-WHOI, Dec 2003.
7    
8     totaldims = ndims(in);
9     index = 1: totaldims;
10     index(index==DIM) = [];
11     index = [DIM index];
12     sizin = size(in);
13     in = permute(in,index);
14     in = reshape(in,sizin(DIM),prod(sizin)./sizin(DIM));
15    
16     if shift>=0
17     shift = shift - size(in,1);
18     end
19    
20     out = [in(shift+1+size(in,1):size(in,1),:);in(1:size(in,1)+shift,:)];
21     out = reshape(out,sizin(index));
22     out = ipermute(out,index);

  ViewVC Help
Powered by ViewVC 1.1.22