Changeset 15126
- Timestamp:
- 05/28/13 11:55:54 (12 years ago)
- Location:
- issm/trunk-jpl/src/m/lambert
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/lambert/lambert2xy.m
r15106 r15126 1 function [x,y] = lambert2xy(lat,lon, projection_center_lat,projection_center_lon)1 function [x,y] = lambert2xy(lat,lon,sgn,projection_center_lat,projection_center_lon) 2 2 %LAMBERT2XY - converts lat long from Lambert Azimuthal to Polar Stereographic 3 3 % … … 7 7 % 8 8 % Usage: 9 % [x,y] = l l2xy(lat,lon)10 % [x,y] = l l2xy(lat,lon,projection_center_lat,projection_center_lon)9 % [x,y] = lambert2xy(lat,lon,sgn) 10 % [x,y] = lambert2xy(lat,lon,sgn,projection_center_lat,projection_center_lon) 11 11 % 12 12 % - provide lat in [-90,90] and lon in [-180,180]. 13 % 14 % - default: North hemisphere [projection center lat = 90 lon=0]15 % South hemisphere [projection center lat = -90 lon=0]13 14 % - sgn = +1 N hemisphere [default projection center lat = 90 lon=0] 15 % -1 S hemisphere [default projection center lat = -90 lon=0] 16 16 17 17 %Get projection_center_lat and projection_center_lon 18 if nargin== 4,18 if nargin==5, 19 19 latitude0 = projection_center_lat; 20 20 longitude0 = projection_center_lon; 21 elseif nargin== 2,22 if lat>0,21 elseif nargin==3, 22 if sgn==1, 23 23 latitude0 = 90; longitude0 = 0; 24 24 disp('Info: creating coordinates in polar stereographic (Projection center lat: 90N lon: 0)'); 25 elseif lat<0,25 elseif sgn==-1, 26 26 latitude0 = -90; longitude0 = 0; 27 27 disp('Info: creating coordinates in polar stereographic (Projection center lat: 90S lon: 0)'); 28 else 29 error('Sign should be either +1 or -1'); 28 30 end 29 31 else … … 58 60 59 61 % Calculation of x and y 60 if(lat==90) 61 rho=a*sqrt(qp-q); 62 x=rho*sin(lam-lam0); 63 y=-rho*cos(lam-lam0); 64 elseif(lat==-90) 65 rho=a*sqrt(qp+q); 66 x=rho*sin(lam-lam0); 67 y=rho*cos(lam-lam0); 62 if(abs(lat)==90) 63 x=0.0; 64 y=0.0; 68 65 else 69 66 x=(B*D)*(cos(b)*sin(lam-lam0)); 70 67 y=(B/D)*((cos(b0)*sin(b))-(sin(b0)*cos(b)*cos(lam-lam0))); 71 68 end 69
Note:
See TracChangeset
for help on using the changeset viewer.