/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/pert.m
ViewVC logotype

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/pert.m

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


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch: MAIN, initial
CVS Tags: baseline, HEAD
Changes since 1.1: +0 -0 lines
Checking in work done with Dimitri on high-resolution cube gridding and parallel 
communications. 
   o code is in a contrib experiment for now so we can continue collaborating
     on it. However most code is general and will be moved into main branch once 
     it is fully hardened.
   o There are README files in the contrib root and in the subdirectories that
     explain the contents

1 function [Tp] = pert(T);
2 % Calculates the perturbation about the mean of the first direction.
3
4 N=size(T);
5 T=reshape(T,[N(1) prod(N)/N(1)]);
6
7 q=T;q(isnan(T))=0;
8 qm=0*q+1;qm(find(q==0))=0;
9 n=sum(qm,1); n(find(n==0))=1;
10 tx=sum(q,1)./n;
11 n=sum(qm,2); n(find(n==0))=1;
12 ty=sum(q,2)./n;
13 [Ty,Tx]=ndgrid(ty,tx);
14
15 Tp=reshape( T-Tx.*qm ,N);

  ViewVC Help
Powered by ViewVC 1.1.22