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

Contents of /MITgcm_contrib/high_res_cube/matlab-grid-generator/bin/longitude.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 (23 years 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 [X] = longitude(x)
2 % X=longitude(x);
3 %
4 % tries to determine best range of longitude (e.g. -180<180 or 0<360)
5 % so that coordinate (x) doesn't span a discontinuity.
6 %
7
8 % also works for radians which are assumed if range of x<=2*pi
9
10 minx=min(min(min(x)));
11 maxx=max(max(max(x)));
12 %if maxx-minx < 2.2*pi
13 % units=180/pi;
14 %else
15 units=1;
16 %end
17 minx=min(min(min(x*units)));
18 maxx=max(max(max(x*units)));
19
20 X=mod(720+x*units,360);
21 maxP=max(max(max(X)));
22 minP=min(min(min(X)));
23
24 XX=mod(X+180,360)-180;
25 maxM=max(max(max(XX)));
26 minM=min(min(min(XX)));
27
28 if maxP-minP > maxM-minM
29 X=XX;
30 end

  ViewVC Help
Powered by ViewVC 1.1.22