Changeset 2271
- Timestamp:
- 09/22/09 13:38:39 (16 years ago)
- Location:
- issm/trunk/src/m/utils/LatLong
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/utils/LatLong/ll2xy.m
r2079 r2271 11 11 re = 6378137.0; % WGS84 12 12 e2 = 0.00669437999015; % WGS84 13 sn= -1.0; % because it's southern hemisphere13 sn=+1.0; % because it's southern hemisphere 14 14 15 15 a=re; -
issm/trunk/src/m/utils/LatLong/mapll.m
r2079 r2271 1 function [x,y]=mapll(lat,lon,hem );1 function [x,y]=mapll(lat,lon,hem,varargin); 2 2 %MAPLL - convert latitude and longitude into x and y 3 3 % … … 10 10 % See also MAPXY, LL2XY 11 11 12 %check number of arguments. 13 if ~((nargin==3) | (nargin==5)), 14 mapllerrorusage(); 15 end 16 17 %hem: must be either 's' or 'n' 18 if ~ischar(hem), 19 error('mapll error message: hemisphere argument should be ''n'' or ''s'''); 20 end 21 22 %check hem is either 'n' or 's': 23 if ~(hem=='s' | hem=='n'), 24 error('mapll error message: hem should be ''s'' or ''n'''); 25 end 26 27 %set sn: 28 if hem=='s', 29 slat=71; 30 sn=-1.0; 31 xlam=0; 32 else 33 slat=70; 34 sn=1.0; 35 xlam=45; 36 end 37 38 %set defaults for standard parallels and centre meridians. 39 if nargin==5, 40 slat=varargin{1}; 41 xlam=varargin{2}; 42 end 43 44 12 45 %some corrections 13 46 lon=lon+360; % to have 0<lon<360 … … 17 50 e2= 0.00669437999015; 18 51 e=sqrt(e2); 19 20 %Standard parallel - latitude with no distortion = -71.21 if hem==1,22 %Northern hemisphere23 sn=1;24 slat=70;25 xlam=45;26 else27 %Southern Hemisphere28 sn=-1.0;29 slat=71;30 xlam=0;31 end32 52 33 53 lat=sn*lat*pi/180; … … 48 68 x= rho*sn.*sin((lon+xlam)); 49 69 y=-rho*sn.*cos((lon+xlam)); 70 71 end 72 73 function mapllerrorusage(), 74 help mapll 75 end -
issm/trunk/src/m/utils/LatLong/mapxy.m
r1 r2271 1 function [alat,alon]=mapxy(x,y,hem );1 function [alat,alon]=mapxy(x,y,hem,varargin); 2 2 %MAPXY - compute latitude and longitude from x and y 3 3 % … … 9 9 % See also MAPLL, LL2XY 10 10 11 %check number of arguments. 12 if ~((nargin==3) | (nargin==5)), 13 mapxyerrorusage(); 14 end 15 16 %hem: must be either 's' or 'n' 17 if ~ischar(hem), 18 error('mapxy error message: hemisphere argument should be ''n'' or ''s'''); 19 end 20 21 %check hem is either 'n' or 's': 22 if ~(hem=='s' | hem=='n'), 23 error('mapxy error message: hem should be ''s'' or ''n'''); 24 end 25 26 %set sn: 27 if hem=='s', 28 slat=71; 29 sn=-1.0; 30 xlam=0; 31 else 32 slat=70; 33 sn=1.0; 34 xlam=45; 35 end 36 37 %set defaults for standard parallels and centre meridians. 38 if nargin==5, 39 slat=varargin{1}; 40 xlam=varargin{2}; 41 end 42 11 43 re = 6378137; 12 44 e2 = 0.00669437999015; 13 45 14 46 e=sqrt(e2); 15 16 %Standard parallel = latitude with no distortion17 slat=71;18 sn=-1.0;19 xlam=0;20 21 if hem ==1,22 slat=70;23 sn=1;24 xlam=45;25 end26 47 27 48 slat=slat/180*pi; … … 54 75 alon(indice)=alon(indice)-360; 55 76 end 77 78 79 end 80 81 82 function mapxyerrorusage() 83 help mapxy 84 end
Note:
See TracChangeset
for help on using the changeset viewer.