/[MITgcm]/MITgcm_contrib/enderton/Diagnostics/DiagUtility/longitude.m
ViewVC logotype

Annotation of /MITgcm_contrib/enderton/Diagnostics/DiagUtility/longitude.m

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


Revision 1.1 - (hide annotations) (download)
Mon Jan 31 15:43:28 2005 UTC (20 years, 5 months ago) by enderton
Branch: MAIN
CVS Tags: HEAD
 o Initial check in.

1 enderton 1.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