[pyorbital] 01/01: New upstream version 1.1.0
Antonio Valentino
a_valentino-guest at moszumanska.debian.org
Sun Oct 30 09:11:00 UTC 2016
This is an automated email from the git hooks/post-receive script.
a_valentino-guest pushed a commit to branch upstream
in repository pyorbital.
commit 2afd90f7f79881d04403550f1d9026222f8ec531
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date: Sun Oct 30 07:44:55 2016 +0000
New upstream version 1.1.0
---
.travis.yml | 3 +++
changelog.rst | 15 +++++++++++++++
pyorbital/geoloc.py | 7 +++++--
pyorbital/geoloc_example.py | 2 +-
pyorbital/orbital.py | 2 +-
pyorbital/tests/test_aiaa.py | 6 +++---
pyorbital/tests/test_geoloc.py | 6 +++---
pyorbital/tests/test_orbital.py | 10 +++++-----
pyorbital/tests/test_tlefile.py | 6 +++---
pyorbital/tlefile.py | 35 ++++++++++++++++++++++++-----------
pyorbital/version.py | 2 +-
11 files changed, 64 insertions(+), 30 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index e312646..1badffc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,9 @@ language: python
python:
- '2.6'
- '2.7'
+- "3.3"
+- "3.4"
+- "3.5"
install:
- pip install .
- pip install coveralls
diff --git a/changelog.rst b/changelog.rst
index c858212..17619cf 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -1,6 +1,21 @@
Changelog
=========
+v1.1.0 (2016-10-27)
+-------------------
+
+- Update changelog. [Martin Raspaud]
+
+- Bump version: 1.0.1 → 1.1.0. [Martin Raspaud]
+
+- Merge branch 'master' into develop. [Martin Raspaud]
+
+- Enable travis testing for py3. [Antonio Valentino]
+
+- Fix regression in TLE reading. [Antonio Valentino]
+
+- Python 3 compatibility. [Antonio Valentino]
+
v1.0.1 (2016-02-17)
-------------------
diff --git a/pyorbital/geoloc.py b/pyorbital/geoloc.py
index 7ec4932..2589705 100644
--- a/pyorbital/geoloc.py
+++ b/pyorbital/geoloc.py
@@ -29,6 +29,8 @@
# - optimize !!!
# - test !!!
+from __future__ import print_function
+
import numpy as np
from numpy import cos, sin, sqrt
from datetime import timedelta
@@ -207,9 +209,10 @@ def get_lonlatalt(pos, utc_time):
# END OF DIRTY STUFF
-def compute_pixels((tle1, tle2), sgeom, times, rpy=(0.0, 0.0, 0.0)):
+def compute_pixels(tle, sgeom, times, rpy=(0.0, 0.0, 0.0)):
"""Compute cartesian coordinates of the pixels in instrument scan.
"""
+ (tle1, tle2) = tle
orb = Orbital("mysatellite", line1=tle1, line2=tle2)
# get position and velocity for each time of each pixel
@@ -298,4 +301,4 @@ if __name__ == '__main__':
# print the lonlats for the pixel positions
s_times = sgeom.times(t)
pixels_pos = compute_pixels((noaa18_tle1, noaa18_tle2), sgeom, s_times)
- print get_lonlatalt(pixels_pos, s_times)
+ print(get_lonlatalt(pixels_pos, s_times))
diff --git a/pyorbital/geoloc_example.py b/pyorbital/geoloc_example.py
index 1200374..5982603 100644
--- a/pyorbital/geoloc_example.py
+++ b/pyorbital/geoloc_example.py
@@ -59,7 +59,7 @@ s_times = sgeom.times(t)
pixels_pos = compute_pixels((tle1, tle2), sgeom, s_times, rpy)
pos_time = get_lonlatalt(pixels_pos, s_times)
-print pos_time
+print(pos_time)
# Plot the result
diff --git a/pyorbital/orbital.py b/pyorbital/orbital.py
index 5860ec7..48a4875 100644
--- a/pyorbital/orbital.py
+++ b/pyorbital/orbital.py
@@ -812,4 +812,4 @@ if __name__ == "__main__":
lon, lat = np.rad2deg((lon, lat))
az, el = o.get_observer_look(t, obs_lon, obs_lat, obs_alt)
ob = o.get_orbit_number(t, tbus_style=True)
- print az, el, ob
+ print(az, el, ob)
diff --git a/pyorbital/tests/test_aiaa.py b/pyorbital/tests/test_aiaa.py
index 40f47c2..5c1fd07 100644
--- a/pyorbital/tests/test_aiaa.py
+++ b/pyorbital/tests/test_aiaa.py
@@ -24,7 +24,7 @@
"""
# TODO: right formal unit tests.
-from __future__ import with_statement
+from __future__ import with_statement, print_function
import os
@@ -102,10 +102,10 @@ class AIAAIntegrationTest(unittest.TestCase):
try:
o = LineOrbital("unknown", line1, line2)
- except NotImplementedError, e:
+ except NotImplementedError as e:
test_line = f__.readline()
continue
- except ChecksumError, e:
+ except ChecksumError as e:
self.assertTrue(test_line.split()[1] in ["33333", "33334", "33335"])
for delay in times:
try:
diff --git a/pyorbital/tests/test_geoloc.py b/pyorbital/tests/test_geoloc.py
index a2a69cc..79c1fbb 100644
--- a/pyorbital/tests/test_geoloc.py
+++ b/pyorbital/tests/test_geoloc.py
@@ -98,9 +98,9 @@ class TestGeoloc(unittest.TestCase):
start_of_scan = datetime(2014, 1, 8, 11, 30)
times = instrument.times(start_of_scan)
- self.assertEquals(times[1], start_of_scan)
- self.assertEquals(times[0], start_of_scan - timedelta(seconds=0.1))
- self.assertEquals(times[2], start_of_scan + timedelta(seconds=0.1))
+ self.assertEqual(times[1], start_of_scan)
+ self.assertEqual(times[0], start_of_scan - timedelta(seconds=0.1))
+ self.assertEqual(times[2], start_of_scan + timedelta(seconds=0.1))
def test_geodetic_lat(self):
"""Test the determination of the geodetic latitude.
diff --git a/pyorbital/tests/test_orbital.py b/pyorbital/tests/test_orbital.py
index 9704ca6..5238136 100644
--- a/pyorbital/tests/test_orbital.py
+++ b/pyorbital/tests/test_orbital.py
@@ -52,9 +52,9 @@ class Test(unittest.TestCase):
expected_lon = -68.199894472013213
expected_lat = 23.159747677881075
expected_alt = 392.01953430856935
- self.failUnless(np.abs(lon - expected_lon) < eps_deg, 'Calculation of sublon failed')
- self.failUnless(np.abs(lat - expected_lat) < eps_deg, 'Calculation of sublat failed')
- self.failUnless(np.abs(alt - expected_alt) < eps_deg, 'Calculation of altitude failed')
+ self.assertTrue(np.abs(lon - expected_lon) < eps_deg, 'Calculation of sublon failed')
+ self.assertTrue(np.abs(lat - expected_lat) < eps_deg, 'Calculation of sublat failed')
+ self.assertTrue(np.abs(alt - expected_alt) < eps_deg, 'Calculation of altitude failed')
def test_observer_look(self):
@@ -65,8 +65,8 @@ class Test(unittest.TestCase):
az, el = sat.get_observer_look(d, -84.39733, 33.775867, 0)
expected_az = 122.45169655331965
expected_el = 1.9800219611255456
- self.failUnless(np.abs(az - expected_az) < eps_deg, 'Calculation of azimut failed')
- self.failUnless(np.abs(el - expected_el) < eps_deg, 'Calculation of elevation failed')
+ self.assertTrue(np.abs(az - expected_az) < eps_deg, 'Calculation of azimut failed')
+ self.assertTrue(np.abs(el - expected_el) < eps_deg, 'Calculation of elevation failed')
def test_orbit_num_an(self):
sat = orbital.Orbital("METOP-A",
diff --git a/pyorbital/tests/test_tlefile.py b/pyorbital/tests/test_tlefile.py
index b7e41e1..4ddb373 100644
--- a/pyorbital/tests/test_tlefile.py
+++ b/pyorbital/tests/test_tlefile.py
@@ -42,7 +42,7 @@ class TLETest(unittest.TestCase):
ISS (ZARYA)
1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927
2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537
-
+
"""
def check_example(self, tle):
@@ -83,7 +83,7 @@ class TLETest(unittest.TestCase):
from os import write, close, remove
filehandle, filename = mkstemp()
try:
- write(filehandle, "\n".join([line0, line1, line2]))
+ write(filehandle, "\n".join([line0, line1, line2]).encode('utf-8'))
close(filehandle)
tle = Tle("ISS (ZARYA)", filename)
self.check_example(tle)
@@ -97,6 +97,6 @@ def suite():
loader = unittest.TestLoader()
mysuite = unittest.TestSuite()
mysuite.addTest(loader.loadTestsFromTestCase(TLETest))
-
+
return mysuite
diff --git a/pyorbital/tlefile.py b/pyorbital/tlefile.py
index 1d57775..d2d016d 100644
--- a/pyorbital/tlefile.py
+++ b/pyorbital/tlefile.py
@@ -23,9 +23,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import io
import logging
import datetime
-import urllib2
+try:
+ from urllib2 import urlopen
+except ImportError:
+ from urllib.request import urlopen
import os
import glob
@@ -140,7 +144,7 @@ def fetch(destination):
"""
with open(destination, "w") as dest:
for url in TLE_URLS:
- response = urllib2.urlopen(url)
+ response = urlopen(url)
dest.write(response.read())
@@ -221,34 +225,39 @@ class Tle(object):
if self._line1 is not None and self._line2 is not None:
tle = self._line1.strip() + "\n" + self._line2.strip()
else:
+ def _open(filename):
+ return io.open(filename, 'rb')
+
if self._tle_file:
urls = (self._tle_file,)
- open_func = open
+ open_func = _open
elif "TLES" in os.environ:
# TODO: get the TLE file closest in time to the actual satellite
# overpass, NOT the latest!
urls = (max(glob.glob(os.environ["TLES"]),
key=os.path.getctime), )
LOGGER.debug("Reading TLE from %s", urls[0])
- open_func = open
+ open_func = _open
else:
LOGGER.debug("Fetch TLE from the internet.")
urls = TLE_URLS
- open_func = urllib2.urlopen
+ open_func = urlopen
tle = ""
designator = "1 " + SATELLITES.get(self._platform, '')
for url in urls:
fid = open_func(url)
for l_0 in fid:
+ l_0 = l_0.decode('utf-8')
if l_0.strip() == self._platform:
- l_1, l_2 = fid.next(), fid.next()
+ l_1 = next(fid).decode('utf-8')
+ l_2 = next(fid).decode('utf-8')
tle = l_1.strip() + "\n" + l_2.strip()
break
if(self._platform in SATELLITES and
l_0.strip().startswith(designator)):
l_1 = l_0
- l_2 = fid.next()
+ l_2 = next(fid).decode('utf-8')
tle = l_1.strip() + "\n" + l_2.strip()
LOGGER.debug("Found platform %s, ID: %s",
self._platform,
@@ -306,10 +315,14 @@ class Tle(object):
def __str__(self):
import pprint
- import StringIO
- s_var = StringIO.StringIO()
+ import sys
+ if sys.version_info < (3, 0):
+ from StringIO import StringIO
+ else:
+ from io import StringIO
+ s_var = StringIO()
d_var = dict(([(k, v) for k, v in
- self.__dict__.items() if k[0] != '_']))
+ list(self.__dict__.items()) if k[0] != '_']))
pprint.pprint(d_var, s_var)
return s_var.getvalue()[:-1]
@@ -317,7 +330,7 @@ def main():
'''Main for testing TLE reading.
'''
tle_data = read('Noaa-19')
- print tle_data
+ print(tle_data)
if __name__ == '__main__':
main()
diff --git a/pyorbital/version.py b/pyorbital/version.py
index b632c1e..b233f3b 100644
--- a/pyorbital/version.py
+++ b/pyorbital/version.py
@@ -23,4 +23,4 @@
"""Version file.
"""
-__version__ = "v1.0.1"
+__version__ = "v1.1.0"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pyorbital.git
More information about the Pkg-grass-devel
mailing list