Changeset 27471


Ignore:
Timestamp:
12/21/22 11:46:44 (2 years ago)
Author:
Mathieu Morlighem
Message:

CHG: do not call CoordTransform anymore because we need proj.db, and use WGS84 ellipsoid (left Hughes elipsoid there but it is commented out)

Location:
issm/trunk-jpl/src/m/coordsystems
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/coordsystems/ll2xy.m

    r27038 r27471  
    4040end
    4141
    42 %Move to CoordTransform now...
    43 if exist('CoordTransform_matlab')==3
    44         disp('Calling CoordTransform instead, make sure to change your MATLAB script');
    45         if sgn==+1
    46                 if delta==45 && slat==70      %BedMachine
    47                         [x y]=CoordTransform(lat,lon,'EPSG:4326','EPSG:3413'); return;
    48                 elseif delta==0 && slat==75   %IBCAO
    49                         [x y]=CoordTransform(lat,lon,'EPSG:4326','EPSG:3996'); return;
    50                 elseif delta==39 && slat==71  %Bamber
    51                         Bamber_proj = '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
    52                         [x y]=CoordTransform(lat,lon,'EPSG:4326',Bamber_proj); return;
    53                 else
    54                         error('not supported yet');
    55                 end
    56         else
    57                 assert(delta==0); assert(slat ==71);
    58                 [x y]=CoordTransform(lat,lon,'EPSG:4326','EPSG:3031');
    59                 return;
    60         end
     42%Choose ellipsoid
     43if 0
     44        %Hughes ellipsoid
     45        re   = 6378.273*10^3; % Radius of the earth in meters
     46        ex2 = .006693883;     % Eccentricity of the Hughes ellipsoid squared
     47else
     48        %WGS84 ellipsoid
     49        re = 6378137;         % Radius of the earth in meters
     50        f  = 1./298.257223563;% Earth flattening
     51        ex2 = 2*f-f^2         % Eccentricity squared
    6152end
    6253
    63 % Conversion constant from degrees to radians
    64 cde  = 57.29577951;
    65 % Radius of the earth in meters
    66 re   = 6378.273*10^3;
    67 % Eccentricity of the Hughes ellipsoid squared
    68 ex2   = .006693883;
    69 % Eccentricity of the Hughes ellipsoid
    70 ex    =  sqrt(ex2);
     54% Eccentricity
     55ex = sqrt(ex2);
    7156
    7257latitude  = abs(lat) * pi/180.;
  • issm/trunk-jpl/src/m/coordsystems/xy2ll.m

    r27038 r27471  
    3636end
    3737
    38 %Move to CoordTransform now...
    39 if exist('CoordTransform_matlab')==3
    40         disp('Calling CoordTransform instead, make sure to change your MATLAB script');
    41         if sgn==+1
    42                 if delta==45 && slat==70      %BedMachine
    43                         [lat lon]=CoordTransform(x, y,'EPSG:3413','EPSG:4326'); return;
    44                 elseif delta==0 && slat==75   %IBCAO
    45                         [lat lon]=CoordTransform(x, y,'EPSG:3996','EPSG:4326'); return;
    46                 elseif delta==39 && slat==71  %Bamber
    47                         Bamber_proj = '+proj=stere +lat_0=90 +lat_ts=71 +lon_0=-39 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs';
    48                         [lat lon]=CoordTransform(x, y, Bamber_proj, 'EPSG:4326'); return;
    49                 else
    50                         error('not supported yet');
    51                 end
    52         else
    53                 assert(delta==0); assert(slat ==71);
    54                 [lat lon]=CoordTransform(x, y,'EPSG:3031','EPSG:4326');
    55                 return;
    56         end
     38%Choose ellipsoid
     39if 0
     40        %Hughes ellipsoid
     41        re   = 6378.273*10^3; % Radius of the earth in meters
     42        ex2 = .006693883;     % Eccentricity of the Hughes ellipsoid squared
     43else
     44        %WGS84 ellipsoid
     45        re = 6378137;         % Radius of the earth in meters
     46        f  = 1./298.257223563;% Earth flattening
     47        ex2 = 2*f-f^2         % Eccentricity squared
    5748end
    5849
    59 if nargout~=3 & nargout~=2,
    60         help xy2ll
    61         error('bad usage');
    62 end
    63 
    64 % Conversion constant from degrees to radians
    65 cde  = 57.29577951;
    66 % Radius of the earth in meters
    67 re   = 6378.273*10^3;
    68 % Eccentricity of the Hughes ellipsoid squared
    69 ex2   = .006693883;
    70 % Eccentricity of the Hughes ellipsoid
    71 ex    =  sqrt(ex2);
     50% Eccentricity
     51ex = sqrt(ex2);
    7252
    7353sl  = slat*pi/180.;
Note: See TracChangeset for help on using the changeset viewer.