Changeset 8715
- Timestamp:
- 06/24/11 14:15:04 (14 years ago)
- Location:
- issm/trunk/src/c/modules
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/Ll2xyx/Ll2xyx.cpp
r8706 r8715 22 22 % -1 : south latitude (default is mer=0 lat=71) 23 23 */ 24 double delta,slat; 25 bool flag=true; 24 double central_meridian,standard_parallel; 26 25 27 /* Get central_meridian and standard_parallel depending on hemisphere */ 28 if (sgn == 1) { 29 delta= 45; 30 slat = 70; 31 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n"); 32 } 33 else if (sgn == -1) { 34 delta= 0; 35 slat = 71; 36 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n"); 37 } 38 else _error_("Sign should be either +1 or -1.\n"); 26 Ll2xydef(¢ral_meridian,&standard_parallel,sgn); 39 27 40 return(Ll2xyx(x,y, lat,lon,ncoord, sgn,delta,slat));28 return(Ll2xyx(x,y,lat,lon,ncoord,sgn,central_meridian,standard_parallel)); 41 29 } 42 30 … … 59 47 int i,iret=0; 60 48 double delta,slat; 61 double cde,re,ex2,ex ,pi;49 double cde,re,ex2,ex; 62 50 double latitude,longitude; 63 51 double T,rho,sl,tc,mc; … … 105 93 return(iret); 106 94 } 95 96 void Ll2xydef(double* pdelta, double* pslat, int sgn){ 97 /* This is a cpp conversion of the following: 98 %LL2XY - converts lat long to polar stereographic 99 % 100 % Converts from geodetic latitude and longitude to Polar 101 % Stereographic (X,Y) coordinates for the polar regions. 102 % Author: Michael P. Schodlok, December 2003 (map2ll) 103 % 104 % Usage: 105 % [x,y] = ll2xy(lat,lon,sgn) 106 % [x,y] = ll2xy(lat,lon,sgn,central_meridian,standard_parallel) 107 % 108 % - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70) 109 % -1 : south latitude (default is mer=0 lat=71) 110 */ 111 bool flag=true; 112 113 /* Get central_meridian and standard_parallel depending on hemisphere */ 114 if (sgn == 1) { 115 *pdelta= 45; 116 *pslat = 70; 117 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n"); 118 } 119 else if (sgn == -1) { 120 *pdelta= 0; 121 *pslat = 71; 122 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n"); 123 } 124 else _error_("Sign should be either +1 or -1.\n"); 125 126 return; 127 } -
issm/trunk/src/c/modules/Ll2xyx/Ll2xyx.h
r8698 r8715 9 9 int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn); 10 10 int Ll2xyx(double* x, double* y, double* lat, double* lon, int ncoord, int sgn, double central_meridian, double standard_parallel); 11 void Ll2xydef(double* pdelta, double* pslat, int sgn); 11 12 12 13 #endif /* _LL2XYX_H */ -
issm/trunk/src/c/modules/Xy2llx/Xy2llx.cpp
r8698 r8715 23 23 % -1 : south latitude (default is mer=0 lat=71) 24 24 */ 25 double central_meridian,standard_parallel; 25 26 26 double delta,slat; 27 bool flag=true; 27 Xy2lldef(¢ral_meridian,&standard_parallel,sgn); 28 28 29 /* Get central_meridian and standard_parallel depending on hemisphere */ 30 if (sgn == 1) { 31 delta= 45; 32 slat = 70; 33 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n"); 34 } 35 else if (sgn == -1) { 36 delta= 0; 37 slat = 71; 38 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n"); 39 } 40 else _error_("Sign should be either +1 or -1.\n"); 41 42 return(Xy2llx(lat,lon,x,y,ncoord,sgn,delta,slat)); 29 return(Xy2llx(lat,lon,x,y,ncoord,sgn,central_meridian,standard_parallel)); 43 30 } 44 31 … … 62 49 int i,iret=0; 63 50 double delta,slat; 64 double cde,re,ex2,ex ,pi;51 double cde,re,ex2,ex; 65 52 double sl,rho,cm,T,chi; 66 53 … … 106 93 } 107 94 108 lon[i] = lon[i] * 180. / pi;109 lat[i] = lat[i] * 180. / pi;95 lon[i] = lon[i] * 180. / PI; 96 lat[i] = lat[i] * 180. / PI; 110 97 lon[i] = lon[i] - delta; 111 98 } … … 113 100 return(iret); 114 101 } 102 103 void Xy2lldef(double* pdelta, double* pslat, int sgn){ 104 /* This is a cpp conversion of the following: 105 %XY2LL - converts xy to lat long 106 % 107 % Converts Polar Stereographic (X,Y) coordinates for the polar regions to 108 % latitude and longitude Stereographic (X,Y) coordinates for the polar 109 % regions. 110 % Author: Michael P. Schodlok, December 2003 (map2xy.m) 111 % 112 % Usage: 113 % [lat,lon] = xy2ll(x,y,sgn); 114 % [lat,lon] = xy2ll(x,y,sgn,central_meridian,standard_parallel); 115 % 116 % - sgn = Sign of latitude +1 : north latitude (default is mer=45 lat=70) 117 % -1 : south latitude (default is mer=0 lat=71) 118 */ 119 bool flag=true; 120 121 /* Get central_meridian and standard_parallel depending on hemisphere */ 122 if (sgn == 1) { 123 *pdelta= 45; 124 *pslat = 70; 125 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n"); 126 } 127 else if (sgn == -1) { 128 *pdelta= 0; 129 *pslat = 71; 130 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n"); 131 } 132 else _error_("Sign should be either +1 or -1.\n"); 133 134 return; 135 } -
issm/trunk/src/c/modules/Xy2llx/Xy2llx.h
r8698 r8715 9 9 int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn); 10 10 int Xy2llx(double* lat, double* lon, double* x, double* y, int ncoord, int sgn, double central_meridian, double standard_parallel); 11 void Xy2lldef(double* pdelta, double* pslat, int sgn); 11 12 12 13 #endif /* _XY2LLX_H */
Note:
See TracChangeset
for help on using the changeset viewer.