Ignore:
Timestamp:
06/07/17 10:50:54 (8 years ago)
Author:
Eric.Larour
Message:

CHG: merged branch back to trunk-jpl 21754.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-larour-NatGeoScience2016/src/py3/coordsystems/ll2xy.py

    r19895 r21759  
    1 import numpy as npy
     1import numpy as np
    22
    33def ll2xy(lat,lon,sgn=-1,central_meridian=0,standard_parallel=71):
     
    3636        ex2 = .006693883
    3737        # Eccentricity of the Hughes ellipsoid
    38         ex = npy.sqrt(ex2)
     38        ex = np.sqrt(ex2)
    3939       
    40         latitude = npy.abs(lat) * npy.pi/180.
    41         longitude = (lon + delta) * npy.pi/180.
     40        latitude = np.abs(lat) * np.pi/180.
     41        longitude = (lon + delta) * np.pi/180.
    4242       
    4343        # compute X and Y in grid coordinates.
    44         T = npy.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)
    4545       
    4646        if (90 - slat) <  1.e-5:
    47                 rho = 2.*re*T/npy.sqrt((1.+ex)**(1.+ex)*(1.-ex)**(1.-ex))
     47                rho = 2.*re*T/np.sqrt((1.+ex)**(1.+ex)*(1.-ex)**(1.-ex))
    4848        else:
    49                 sl  = slat*npy.pi/180.
    50                 tc  = npy.tan(npy.pi/4.-sl/2.)/((1.-ex*npy.sin(sl))/(1.+ex*npy.sin(sl)))**(ex/2.)
    51                 mc  = npy.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))
    5252                rho = re*mc*T/tc
    5353       
    54         y = -rho * sgn * npy.cos(sgn*longitude)
    55         x =  rho * sgn * npy.sin(sgn*longitude)
     54        y = -rho * sgn * np.cos(sgn*longitude)
     55        x =  rho * sgn * np.sin(sgn*longitude)
    5656
    57         cnt1=npy.nonzero(latitude>= npy.pi/2.)[0]
     57        cnt1=np.nonzero(latitude>= np.pi/2.)[0]
    5858       
    5959        if cnt1:
Note: See TracChangeset for help on using the changeset viewer.