[Git][debian-gis-team/pygac][upstream] New upstream version 1.2.1
Antonio Valentino
gitlab at salsa.debian.org
Sun Nov 17 07:23:35 GMT 2019
Antonio Valentino pushed to branch upstream at Debian GIS Project / pygac
Commits:
c97f8151 by Antonio Valentino at 2019-11-17T06:54:06Z
New upstream version 1.2.1
- - - - -
9 changed files:
- .bumpversion.cfg
- .travis.yml
- CHANGELOG.md
- pygac/gac_reader.py
- pygac/geotiepoints.py → pygac/pygac_geotiepoints.py
- pygac/tests/test_io.py
- pygac/tests/test_reader.py
- pygac/utils.py
- pygac/version.py
Changes:
=====================================
.bumpversion.cfg
=====================================
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 1.2.0
+current_version = 1.2.1
commit = True
tag = True
=====================================
.travis.yml
=====================================
@@ -1,6 +1,7 @@
language: python
python:
- "2.7_with_system_site_packages"
+ - "3.7"
# command to install dependencies, e.g.
install:
- pip install -r requirements.txt
=====================================
CHANGELOG.md
=====================================
@@ -1,10 +1,26 @@
+## Version 1.2.1 (2019/11/15)
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 37](https://github.com/pytroll/pygac/pull/37) - Fixing geotiepoints attribute error for python2.7
+* [PR 36](https://github.com/pytroll/pygac/pull/36) - Fix update of missing scanlines
+
+#### Features added
+
+* [PR 38](https://github.com/pytroll/pygac/pull/38) - Fix tests for python 3
+
+In this release 3 pull requests were closed.
+
## Version 1.2.0 (2019/10/17)
### Issues Closed
+* [Issue 33](https://github.com/pytroll/pygac/issues/33) - Make use of pytroll geotiepoints instead of using a deprecated copy
* [Issue 7](https://github.com/pytroll/pygac/issues/7) - Project URL points to wrong domain
-In this release 1 issue was closed.
+In this release 2 issues were closed.
### Pull Requests Merged
@@ -14,10 +30,12 @@ In this release 1 issue was closed.
#### Features added
+* [PR 35](https://github.com/pytroll/pygac/pull/35) - Changed azimuth angle range to ]-180, 180]
* [PR 34](https://github.com/pytroll/pygac/pull/34) - Use the geotiepoints library
+* [PR 32](https://github.com/pytroll/pygac/pull/32) - Updated documentation about azimuth angles
* [PR 31](https://github.com/pytroll/pygac/pull/31) - Refactor I/O
-In this release 3 pull requests were closed.
+In this release 5 pull requests were closed.
## Version 1.1.0 (2019/06/12)
=====================================
pygac/gac_reader.py
=====================================
@@ -41,7 +41,7 @@ from pyorbital.orbital import Orbital
from pyorbital import astronomy
import datetime
from pygac.calibration import calibrate_solar, calibrate_thermal
-import pygac.geotiepoints as gtp
+import pygac.pygac_geotiepoints as gtp
LOG = logging.getLogger(__name__)
@@ -792,7 +792,7 @@ class GACReader(six.with_metaclass(ABCMeta)):
# find the missing line numbers.
ideal = set(range(1, self.scans['scan_line_number'][-1] + 1))
missing = sorted(ideal.difference(set(self.scans['scan_line_number'])))
- return np.array(missing)
+ return np.array(missing, dtype=int)
def mask_tsm_pixels(self, channels):
"""Mask pixels affected by the scan motor issue."""
=====================================
pygac/geotiepoints.py → pygac/pygac_geotiepoints.py
=====================================
@@ -21,8 +21,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-"""Interpolation of geographical tiepoints.
-"""
+"""Interpolation of geographical tiepoints."""
import geotiepoints as gtp
@@ -30,12 +29,13 @@ import geotiepoints as gtp
import numpy as np
-
def Gac_Lat_Lon_Interpolator(lons_subset, lats_subset):
- """Interpolate lat-lon values in the AVHRR GAC data from every eigth pixel to all pixels.
+ """Interpolate lat-lon values in the AVHRR GAC data.
+
+ Each GAC row has 409 pixels.
+ But lat-lon values are provided for every eigth pixel,
+ ranging from 5 to 405. Interpolate to full resolution.
- Each GAC row has total 409 pixels. But lat-lon values are provided for every eigth pixel
- starting from pixel 5 and ending at pixel 405.
"""
# cols_subset = np.arange(0, 404, 8)
# cols_full = np.arange(405)
=====================================
pygac/tests/test_io.py
=====================================
@@ -17,9 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""Test the I/O."""
import unittest
-import mock
+try:
+ import mock
+except ImportError:
+ from unittest import mock
import numpy as np
import numpy.testing
import pygac.gac_io as gac_io
@@ -27,17 +31,19 @@ import pygac.utils as utils
class TestIO(unittest.TestCase):
- """Test the gac_io module"""
+ """Test the gac_io module."""
longMessage = True
def test_strip_invalid_lat(self):
+ """Test stripping the invalid lats."""
lats = np.array([np.nan, 1, np.nan, 2, np.nan])
start, end = utils.strip_invalid_lat(lats)
self.assertEqual(start, 1)
self.assertEqual(end, 3)
def test_update_scanline(self):
+ """Test updating the scanlines."""
test_data = [{'new_start_line': 100, 'new_end_line': 200,
'scanline': 110, 'scanline_exp': 10},
{'new_start_line': 100, 'new_end_line': 200,
@@ -50,6 +56,7 @@ class TestIO(unittest.TestCase):
self.assertEqual(scanline, scanline_exp)
def test_update_missing_scanlines(self):
+ """Test updating the missing scanlines."""
qual_flags = np.array([[1, 2, 4, 5, 6, 8, 9, 11, 12]]).transpose()
miss_lines = np.array([3, 7, 10])
test_data = [{'start_line': 0, 'end_line': 8,
@@ -62,7 +69,18 @@ class TestIO(unittest.TestCase):
miss_lines=miss_lines, qual_flags=qual_flags, **t)
numpy.testing.assert_array_equal(miss_lines, miss_lines_exp)
+ # If intersection of miss_lines and qual_flags is not empty
+ # (here: extra "1" in miss_lines), make sure that items are
+ # not added twice.
+ miss_lines = utils._update_missing_scanlines(
+ miss_lines=np.array([1, 3, 7, 10]),
+ qual_flags=qual_flags,
+ start_line=3, end_line=6)
+ numpy.testing.assert_array_equal(miss_lines,
+ [1, 2, 3, 4, 7, 10, 11, 12])
+
def test_slice(self):
+ """Test slices."""
ch = np.array([[1, 2, 3, 4, 5]]).transpose()
sliced_exp = np.array([[2, 3, 4]]).transpose()
@@ -134,6 +152,7 @@ class TestIO(unittest.TestCase):
self.assertEqual(midn_line_new, 0)
def test_check_user_scanlines(self):
+ """Check the scanlines."""
# All scanlines
start, end = utils.check_user_scanlines(0, 0, 100, 200)
self.assertEqual(start, 0)
@@ -170,8 +189,9 @@ class TestIO(unittest.TestCase):
@mock.patch('pygac.gac_io.avhrrGAC_io')
@mock.patch('pygac.gac_io.slice_channel')
@mock.patch('pygac.gac_io.check_user_scanlines')
- def test_save_gac(self, check_user_scanlines, slice_channel, avhrrGAC_io,
+ def test_save_gac(self, check_user_scanlines, slice_channel, avhrr_gac_io,
strip_invalid_lat):
+ """Test saving."""
# Test scanline selection
mm = mock.MagicMock()
kwargs = dict(
@@ -234,11 +254,11 @@ class TestIO(unittest.TestCase):
'midnight',
'miss'
]
- avhrrGAC_io.assert_called_with(*expected_args)
+ avhrr_gac_io.assert_called_with(*expected_args)
def suite():
- """The suite for test_io"""
+ """Test suite for test_io."""
loader = unittest.TestLoader()
mysuite = unittest.TestSuite()
mysuite.addTest(loader.loadTestsFromTestCase(TestIO))
=====================================
pygac/tests/test_reader.py
=====================================
@@ -17,10 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""Test the readers."""
import datetime
import unittest
-import mock
+try:
+ import mock
+except ImportError:
+ from unittest import mock
import numpy as np
import numpy.testing
from pygac.gac_reader import GACReader
@@ -34,6 +38,7 @@ class TestGacReader(unittest.TestCase):
@mock.patch.multiple('pygac.gac_reader.GACReader',
__abstractmethods__=set())
def setUp(self, *mocks):
+ """Set up the tests."""
self.reader = GACReader()
def test_to_datetime64(self):
@@ -111,6 +116,21 @@ class TestGacReader(unittest.TestCase):
for method in methods:
method.asser_not_called()
+ @mock.patch('pygac.gac_reader.GACReader._get_corrupt_mask')
+ @mock.patch('pygac.gac_reader.GACReader._adjust_clock_drift')
+ @mock.patch('pygac.gac_reader.GACReader._get_lonlat')
+ def test_interpolate(self, _get_lonlat, _adjust_clock_drift,
+ _get_corrupt_mask):
+ """Test interpolate method in get_lonlat."""
+ self.lons = None
+ self.lats = None
+ lons = 90 * np.random.rand(17, 51)
+ lats = 90 * np.random.rand(17, 51)
+ _get_lonlat.return_value = lons, lats
+ self.interpolate_coors = True
+ lons, lats = self.reader.get_lonlat()
+ self.assertEqual(lons.shape[1], 409)
+
@mock.patch('pygac.gac_reader.GACReader._get_corrupt_mask')
def test_get_corrupt_mask(self, get_corrupt_mask):
"""Test common computation of corrupt scanline mask."""
@@ -146,8 +166,10 @@ class TestGacReader(unittest.TestCase):
self.reader.scans = np.zeros(
len(lines), dtype=[('scan_line_number', 'i2')])
self.reader.scans['scan_line_number'] = lines
- self.assertTrue((self.reader.get_miss_lines() == miss_lines_ref).all(),
+ miss_lines = self.reader.get_miss_lines()
+ self.assertTrue((miss_lines == miss_lines_ref).all(),
msg='Missing scanlines not detected correctly')
+ self.assertEqual(miss_lines.dtype, int)
def test_tle2datetime64(self, *mocks):
"""Test conversion from TLE timestamps to datetime64."""
@@ -267,6 +289,7 @@ class TestGacReader(unittest.TestCase):
Returns:
Corrupted and corrected scanline numbers.
+
"""
along_track = 12000
scans = np.zeros(12000, dtype=[("scan_line_number", ">u2")])
@@ -320,7 +343,7 @@ class TestGacReader(unittest.TestCase):
def suite():
- """The suite for test_reader"""
+ """Test suite for test_reader."""
loader = unittest.TestLoader()
mysuite = unittest.TestSuite()
mysuite.addTest(loader.loadTestsFromTestCase(TestGacReader))
=====================================
pygac/utils.py
=====================================
@@ -30,6 +30,14 @@ def check_user_scanlines(start_line, end_line, first_valid_lat=None,
"""Check user-defined scanlines.
Can be used by both pygac and satpy.
+
+ Args:
+ start_line: User-defined start line (afer stripping, if enabled)
+ end_line: User-defined end line (afer stripping, if enabled)
+ first_valid_lat: First scanline with valid latitudes
+ last_valid_lat: Last scanline with valid latitudes
+ along_track: Number of scanlines (only needed if stripping
+ is disabled)
"""
if first_valid_lat is not None and last_valid_lat is not None:
num_valid_lines = last_valid_lat - first_valid_lat + 1
@@ -155,7 +163,7 @@ def _update_missing_scanlines(miss_lines, qual_flags, start_line, end_line):
start_line: New start line of the slice
end_line: New end line of the slice
"""
- return np.sort(np.array(
+ return np.sort(np.unique(
qual_flags[0:start_line, 0].tolist() +
miss_lines.tolist() +
qual_flags[end_line + 1:, 0].tolist()
=====================================
pygac/version.py
=====================================
@@ -22,4 +22,4 @@
"""Just holding the version of the pygac module."""
-__version__ = '1.2.0'
+__version__ = '1.2.1'
View it on GitLab: https://salsa.debian.org/debian-gis-team/pygac/commit/c97f8151b5ce31bde6bad65365ec07c1aed395c4
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pygac/commit/c97f8151b5ce31bde6bad65365ec07c1aed395c4
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191117/83bb7642/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list