Changeset 6341
- Timestamp:
- 10/19/10 11:12:16 (14 years ago)
- Location:
- issm/trunk/src/m/utils/LatLong
- Files:
-
- 1 added
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/utils/LatLong/ll2xy.m
r3259 r6341 1 function [x,y]=ll2xy(lat,lon); 2 %LL2XY - convert latitude and longitude coordinates to x and y 1 function [x,y] = ll2xy(lat,lon,sgn) 2 %LL2XY - converts lat long to polar stereographic 3 % 4 % Converts from geodetic latitude and longitude to Polar 5 % Stereographic (X,Y) coordinates for the polar regions. 6 % Author: Michael P. Schodlok, December 2003 (map2ll) 3 7 % 4 8 % Usage: 5 % [x,y] =ll2xy(lat,lon)6 % 7 % See also MAPLL, MAPXY9 % [x,y] = map2ll(lat,lon,sgn) 10 % - sgn = Sign of latitude +1 : north latitude 11 % -1 : south latitude 8 12 9 lon=lon+360; % to have 0<lon<360 13 if nargin ~= 3 14 help map2ll 15 error('bad usage'); 16 end 10 17 11 re = 6378137.0; % WGS84 12 e2 = 0.00669437999015; % WGS84 13 sn=-1.0; % because it's southern hemisphere 18 % Conversion constant from degrees to radians 19 cde = 57.29577951; 20 % Standard latitude for the SSM/I grid with no distorsion 21 slat = 70.; 22 % Radius of the earth in meters 23 re = 6378.273*10^3; 24 % Eccentricity of the Hughes ellipsoid squared 25 ex2 = .006693883; 26 % Eccentricity of the Hughes ellipsoid 27 ex = sqrt(ex2); 14 28 15 a=re; 16 e=sqrt(e2); 29 if sgn == 1 30 delta = 45.; 31 else 32 delta = 0.0; 33 end 17 34 18 phi = sn*lat*pi/180;19 l ambda = lon*pi/180;35 latitude = abs(lat) * pi/180.; 36 longitude = (lon + delta) * pi/180.; 20 37 21 qp = 1 - (1-e2)/2/e*log((1-e)/(1+e)); 22 %m=cos(phi)/sqrt(1-e2.*sin(phi)*sin(phi)); 23 q=(1-e2)*(sin(phi)./(1-e2*sin(phi).^2)-0.5/e*log((1-e*sin(phi))./(1+e*sin(phi)))); 24 rho = a*sqrt(qp-q); 25 x = rho.*sin(lambda); 26 y = - sn*rho.*cos(lambda); 38 % compute X and Y in grid coordinates. 39 T = tan(pi/4-latitude/2) ./ ((1-ex*sin(latitude))./(1+ex*sin(latitude))).^(ex/2); 27 40 41 if (90 - slat) < 1.e-5 42 rho = 2.*re*T/sqrt((1.+ex)^(1.+ex)*(1.-ex)^(1.-ex)); 43 else 44 sl = slat*pi/180.; 45 tc = tan(pi/4.-sl/2.)/((1.-ex*sin(sl))/(1.+ex*sin(sl)))^(ex/2.); 46 mc = cos(sl)/sqrt(1.0-ex2*(sin(sl)^2)); 47 rho = re*mc*T/tc; 48 end 28 49 29 %lon=lon-360; % to recover the initial longitude 50 y = -rho .* sgn .* cos(sgn.*longitude); 51 x = rho .* sgn .* sin(sgn.*longitude); 30 52 53 [cnt1,cnt2] = find(latitude >= pi / 2.); 54 55 if cnt1 56 x(cnt1,1) = 0.0 57 y(cnt1,1) = 0.0 58 end -
issm/trunk/src/m/utils/LatLong/utm2ll.m
r1227 r6341 50 50 end 51 51 52 53 54 52 % Memory pre-allocation 55 53 % 56 54 Lat=zeros(n1,1); 57 55 Lon=zeros(n1,1); 58 59 56 60 57 % Main Loop … … 119 116 120 117 end 121
Note:
See TracChangeset
for help on using the changeset viewer.