NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/ll2xy.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function [x,y]=ll2xy(lat,lon,reflat,reflong)
2
3 % [X,Y]=LL2XYGOM(LAT,LON,REFLAT,REFLON)
4 %
5 % Returns X and Y vectors (as distance from arbitrary
6 % origin REFLAT and REFLON) for vectors of latitudes
7 % and longitudes, LAT and LON.
8 %
9 % REFLAT and REFLON default to Boston
10 %
11 % LAT and LON may be specified as LON+i*LAT
12 %
13 % Specifying only a single output yields X+i*Y
14
15 % CVL, 7-10-97
16 % Hacked from mercgom2 from C. Naimie.
17
18 r=6.3675E+6;
19
20 if nargin<3
21         reflong=-71.03*pi/180;
22         reflat=42.35*pi/180;
23 end
24
25 if nargin==1
26         lon=real(lat);
27         lat=imag(lat);
28 end
29
30 xo=r*cos(reflat)*reflong;
31 yo=r*cos(reflat)*log((1.0+sin(reflat))/cos(reflat));
32
33 rlong=lon*pi/180;
34 rlat=lat*pi/180;
35 x=r*cos(reflat).*rlong-xo;
36 y=r*cos(reflat).*log((1.0+sin(rlat))./cos(rlat))-yo;
37
38 if nargout<=1
39         x=x+i*y;
40 end
Note: See TracBrowser for help on using the browser.