Skip to content

Commit e1b52c3

Browse files
committed
template
1 parent 77cb4f1 commit e1b52c3

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

.travis.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ fast_finish: true
33

44
python:
55
- 3.5
6-
- 3.6
76

87
os:
98
- linux
@@ -15,12 +14,8 @@ git:
1514
depth: 3
1615

1716

18-
before_install:
19-
- pip -q install coveralls
20-
21-
install: pip -q install -e .
17+
install: pip -q install -e .[tests]
2218

2319
script: coverage run tests/test.py -v
2420

2521
after_success: coveralls
26-

README.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
.. image:: https://travis-ci.org/scivision/pymap3d.svg?branch=master
88
:target: https://travis-ci.org/scivision/pymap3d
9-
9+
1010
.. image:: https://coveralls.io/repos/github/scivision/pymap3d/badge.svg?branch=master
1111
:target: https://coveralls.io/github/scivision/pymap3d?branch=master
12-
12+
1313
.. image:: https://api.codeclimate.com/v1/badges/b6e4b90175e6dbf1b375/maintainability
1414
:target: https://codeclimate.com/github/scivision/pymap3d/maintainability
1515
:alt: Maintainability
@@ -24,10 +24,15 @@ Python coordinate conversions, following convention of several popular Matlab ro
2424

2525
Install
2626
=======
27-
::
27+
Development::
28+
29+
python -m pip install -e .
30+
31+
32+
simple::
33+
34+
python -m pip install pymap3d
2835

29-
pip install -e .
30-
3136

3237
Usage
3338
=====
@@ -52,12 +57,6 @@ Popular mapping toolbox functions ported to Python include::
5257
azel2radec radec2azel
5358

5459

55-
Installation
56-
============
57-
::
58-
59-
pip install pymap3d
60-
6160

6261
Caveats
6362
=======

pymap3d/__init__.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ def __init__(self):
3535
#%% to AER (azimuth, elevation, range)
3636
def ecef2aer(x, y, z, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
3737
xEast, yNorth, zUp = ecef2enu(x, y, z, lat0, lon0, h0, ell, deg=deg)
38+
3839
return enu2aer(xEast, yNorth, zUp, deg=deg)
3940

4041

4142
def eci2aer(eci, lat0, lon0, h0, t):
4243
ecef = eci2ecef(eci, t)
44+
4345
return ecef2aer(ecef[:, 0], ecef[:, 1], ecef[:, 2], lat0, lon0, h0)
4446

4547

@@ -59,11 +61,14 @@ def enu2aer(e, n, u, deg=True):
5961

6062
def geodetic2aer(lat, lon, h, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
6163
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg)
64+
6265
return enu2aer(e, n, u, deg=deg)
6366

6467

6568
def ned2aer(n, e, d, deg=True):
69+
6670
return enu2aer(e, n, -d, deg=deg)
71+
6772
#%% to ECEF
6873
def aer2ecef(az, el, srange, lat0, lon0, alt0, ell=EarthEllipsoid(), deg=True):
6974
"""
@@ -115,12 +120,14 @@ def eci2ecef(eci, t):
115120

116121
for i in range(N):
117122
ecef[i, :] = _rottrip(gst[i]) @ eci[i, :]
123+
118124
return ecef
119125

120126

121127
def enu2ecef(e1, n1, u1, lat0, lon0, alt0, ell=EarthEllipsoid(), deg=True):
122128
x0, y0, z0 = geodetic2ecef(lat0, lon0, alt0, ell, deg=deg)
123129
dx, dy, dz = _enu2uvw(e1, n1, u1, lat0, lon0, deg=deg)
130+
124131
return x0 + dx, y0 + dy, z0 + dz
125132

126133

@@ -135,14 +142,18 @@ def geodetic2ecef(lat, lon, alt, ell=EarthEllipsoid(), deg=True):
135142
x = (N + alt) * cos(lat) * cos(lon)
136143
y = (N + alt) * cos(lat) * sin(lon)
137144
z = (N * (ell.b / ell.a)**2 + alt) * sin(lat)
145+
138146
return x, y, z
139147

140148

141149
def ned2ecef(n, e, d, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
150+
142151
return enu2ecef(e, n, -d, lat0, lon0, h0, ell, deg=deg)
152+
143153
#%% to ECI
144154
def aer2eci(az, el, srange, lat0, lon0, h0, t, ell=EarthEllipsoid(), deg=True):
145155
x, y, z = aer2ecef(az, el, srange, lat0, lon0, h0, ell, deg)
156+
146157
return ecef2eci(np.column_stack((x, y, z)), t)
147158

148159

@@ -202,6 +213,7 @@ def ecef2enu(x, y, z, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
202213

203214
return _uvw2enu(x - x0, y - y0, z - z0, lat0, lon0, deg=deg)
204215

216+
205217
def ecef2enuv(u, v, w, lat0, lon0, deg=True):
206218
"""
207219
for VECTOR i.e. between two points
@@ -330,21 +342,25 @@ def eci2geodetic(eci, t):
330342

331343
""" a.k.a. eci2lla() """
332344
ecef = eci2ecef(eci, t)
345+
333346
return ecef2geodetic(ecef[:, 0], ecef[:, 1], ecef[:, 2])
334347

335348

336349
def enu2geodetic(e, n, u, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
337350
x, y, z = enu2ecef(e, n, u, lat0, lon0, h0, ell, deg=deg)
351+
338352
return ecef2geodetic(x, y, z, ell, deg=deg)
339353

340354

341355
def ned2geodetic(n, e, d, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
342356
x, y, z = enu2ecef(e, n, -d, lat0, lon0, h0, ell, deg=deg)
357+
343358
return ecef2geodetic(x, y, z, ell, deg=deg)
344359
#%% to NED
345360

346361
def aer2ned(az, elev, slantRange, deg=True):
347362
e, n, u = aer2enu(az, elev, slantRange, deg=deg)
363+
348364
return n, e, -u
349365

350366

@@ -353,30 +369,33 @@ def ecef2ned(x, y, z, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
353369
for coordinate POSITION
354370
"""
355371
e, n, u = ecef2enu(x, y, z, lat0, lon0, h0, ell, deg=deg)
372+
356373
return n, e, -u
357374

358375
def ecef2nedv(u, v, w, lat0, lon0, deg=True):
359376
"""
360377
for VECTOR between two points
361378
"""
362379
e, n, u = ecef2enuv(u, v, w, lat0, lon0, deg=deg)
380+
363381
return n, e, -u
364382

365383
def geodetic2ned(lat, lon, h, lat0, lon0, h0, ell=EarthEllipsoid(), deg=True):
366384
e, n, u = geodetic2enu(lat, lon, h, lat0, lon0, h0, ell, deg=deg)
385+
367386
return n, e, -u
368387

369388
#%% shared functions
370389

371390
def get_radius_normal(lat_radians, ell):
372391
a = ell.a
373392
b = ell.b
393+
374394
return a**2 / sqrt(
375395
a**2 * (cos(lat_radians))**2 + b**2 *
376396
(sin(lat_radians))**2)
377397

378398

379-
380399
def str2dt(t):
381400
"""
382401
output: datetime
@@ -460,6 +479,7 @@ def azel2radec(az_deg, el_deg, lat_deg, lon_deg, t):
460479

461480
return sky.ra.deg, sky.dec.deg
462481

482+
463483
def radec2azel(ra_deg, dec_deg, lat_deg, lon_deg, t):
464484
if Time is None:
465485
raise ImportError('You need to install AstroPy')

setup.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env python
2-
req = ['nose','python-dateutil','pytz','numpy','astropy']
2+
install_requires = ['python-dateutil','pytz','numpy','astropy']
3+
tests_require = ['nose','coveralls']
34
# %%
45
from setuptools import setup,find_packages
56

67
setup(name='pymap3d',
78
packages=find_packages(),
8-
version = '1.2.4',
9+
version = '1.2.5',
910
description='Python coordinate conversions, following convention of several popular Matlab routines.',
11+
long_description=open('README.rst').read(),
1012
author = 'Michael Hirsch, Ph.D.',
1113
url = 'https://github.com/scivision/pymap3d',
1214
classifiers=[
@@ -17,7 +19,9 @@
1719
'Programming Language :: Python :: 3',
1820
'Programming Language :: Python',
1921
],
20-
install_requires=req,
22+
install_requires=install_requires,
23+
tests_require=tests_require,
24+
extras_require={'tests':tests_require},
2125
python_requires='>=3.5', # due to @ matrix mult
2226
)
2327

0 commit comments

Comments
 (0)