- Timestamp:
- 06/07/17 10:50:54 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/branches/trunk-larour-NatGeoScience2016/src/py3/coordsystems/ll2xy.py
r19895 r21759 1 import numpy as np y1 import numpy as np 2 2 3 3 def ll2xy(lat,lon,sgn=-1,central_meridian=0,standard_parallel=71): … … 36 36 ex2 = .006693883 37 37 # Eccentricity of the Hughes ellipsoid 38 ex = np y.sqrt(ex2)38 ex = np.sqrt(ex2) 39 39 40 latitude = np y.abs(lat) * npy.pi/180.41 longitude = (lon + delta) * np y.pi/180.40 latitude = np.abs(lat) * np.pi/180. 41 longitude = (lon + delta) * np.pi/180. 42 42 43 43 # compute X and Y in grid coordinates. 44 T = np y.tan(npy.pi/4-latitude/2) / ((1-ex*npy.sin(latitude))/(1+ex*npy.sin(latitude)))**(ex/2)44 T = np.tan(np.pi/4-latitude/2) / ((1-ex*np.sin(latitude))/(1+ex*np.sin(latitude)))**(ex/2) 45 45 46 46 if (90 - slat) < 1.e-5: 47 rho = 2.*re*T/np y.sqrt((1.+ex)**(1.+ex)*(1.-ex)**(1.-ex))47 rho = 2.*re*T/np.sqrt((1.+ex)**(1.+ex)*(1.-ex)**(1.-ex)) 48 48 else: 49 sl = slat*np y.pi/180.50 tc = np y.tan(npy.pi/4.-sl/2.)/((1.-ex*npy.sin(sl))/(1.+ex*npy.sin(sl)))**(ex/2.)51 mc = np y.cos(sl)/npy.sqrt(1.0-ex2*(npy.sin(sl)**2))49 sl = slat*np.pi/180. 50 tc = np.tan(np.pi/4.-sl/2.)/((1.-ex*np.sin(sl))/(1.+ex*np.sin(sl)))**(ex/2.) 51 mc = np.cos(sl)/np.sqrt(1.0-ex2*(np.sin(sl)**2)) 52 52 rho = re*mc*T/tc 53 53 54 y = -rho * sgn * np y.cos(sgn*longitude)55 x = rho * sgn * np y.sin(sgn*longitude)54 y = -rho * sgn * np.cos(sgn*longitude) 55 x = rho * sgn * np.sin(sgn*longitude) 56 56 57 cnt1=np y.nonzero(latitude>= npy.pi/2.)[0]57 cnt1=np.nonzero(latitude>= np.pi/2.)[0] 58 58 59 59 if cnt1:
Note:
See TracChangeset
for help on using the changeset viewer.