Changeset 6343


Ignore:
Timestamp:
10/19/10 13:10:23 (14 years ago)
Author:
Mathieu Morlighem
Message:

more flexible projection routines

Location:
issm/trunk/src/m/utils/LatLong
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/utils/LatLong/ll2xy.m

    r6341 r6343  
    1 function [x,y] = ll2xy(lat,lon,sgn
     1function [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel
    22%LL2XY - converts lat long to polar stereographic
    33%
     
    77%
    88%   Usage:
    9 %      [x,y] = map2ll(lat,lon,sgn)
    10 %      - sgn = Sign of latitude +1 : north latitude
    11 %                               -1 : south latitude
     9%      [x,y] = ll2xy(lat,lon,sgn)
     10%      [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel)
     11%
     12%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
     13%                               -1 : south latitude (default is mer=0  lat=70)
    1214
    13 if nargin ~= 3
    14         help map2ll
     15%Get central_meridian and standard_parallel depending on hemisphere
     16if nargin==5,
     17        delta = central_meridian;
     18        slat  = standard_parallel;
     19elseif nargin==3
     20        if sgn == 1,
     21                delta = 45; slat = 70;
     22        elseif sgn==-1,
     23                delta = 0;  slat = 70;
     24        else
     25                error('Sign should be either +1 or -1');
     26        end
     27else
     28        help ll2xy
    1529        error('bad usage');
    1630end
     
    1832% Conversion constant from degrees to radians
    1933cde  = 57.29577951;
    20 % Standard latitude for the SSM/I grid with no distorsion
    21 slat = 70.;
    2234% Radius of the earth in meters
    2335re   = 6378.273*10^3;
     
    2638% Eccentricity of the Hughes ellipsoid
    2739ex    =  sqrt(ex2);
    28 
    29 if sgn == 1
    30         delta = 45.;
    31 else
    32         delta = 0.0;
    33 end
    3440
    3541latitude  = abs(lat) * pi/180.;
  • issm/trunk/src/m/utils/LatLong/xy2ll.m

    r6341 r6343  
    1 function [lat,lon] = xy2ll(x,y,sgn)
     1function [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel)
    22%XY2LL - converts xy to lat long
    33%
     
    88%
    99%   Usage:
    10 %      [lat,lon] = map2xy(x,y,sgn);
    11 %      - sgn = Sign of latitude +1 : north latitude
    12 %                               -1 : south latitude
     10%      [lat,lon] = xy2ll(x,y,sgn);
     11%      [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel);
     12%
     13%      - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70)
     14%                               -1 : south latitude (default is mer=0  lat=70)
    1315
    14 if nargin ~= 3
    15         help map2xy
     16%Get central_meridian and standard_parallel depending on hemisphere
     17if nargin==5,
     18        delta = central_meridian;
     19        slat  = standard_parallel;
     20elseif nargin==3
     21        if sgn == 1,
     22                delta = 45; slat = 70;
     23        elseif sgn==-1,
     24                delta = 0;  slat = 70;
     25        else
     26                error('Sign should be either +1 or -1');
     27        end
     28else
     29        help xy2ll
    1630        error('bad usage');
    1731end
     
    1933% Conversion constant from degrees to radians
    2034cde  = 57.29577951;
    21 % Standard latitude for the SSM/I grid with no distorsion
    22 slat = 70.;
    2335% Radius of the earth in meters
    2436re   = 6378.273*10^3;
     
    2739% Eccentricity of the Hughes ellipsoid
    2840ex    =  sqrt(ex2);
    29 
    30 if sgn == 1
    31         delta = 45.;
    32 else
    33         delta = 0.0;
    34 end
    3541
    3642sl  = slat*pi/180.;
Note: See TracChangeset for help on using the changeset viewer.