[Git][debian-gis-team/pyresample][upstream] New upstream version 1.13.1

Antonio Valentino gitlab at salsa.debian.org
Mon Sep 30 07:07:24 BST 2019



Antonio Valentino pushed to branch upstream at Debian GIS Project / pyresample


Commits:
57ba9507 by Antonio Valentino at 2019-09-30T05:40:47Z
New upstream version 1.13.1
- - - - -


6 changed files:

- CHANGELOG.md
- pyresample/geometry.py
- pyresample/test/test_geometry.py
- pyresample/test/test_utils.py
- pyresample/utils/_proj4.py
- pyresample/version.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,15 @@
+## Version 1.13.1 (2019/09/26)
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 218](https://github.com/pytroll/pyresample/pull/218) - Fix proj_str returning invalid PROJ strings when towgs84 was included
+* [PR 217](https://github.com/pytroll/pyresample/pull/217) - Fix get_geostationary_angle_extent assuming a/b definitions
+* [PR 216](https://github.com/pytroll/pyresample/pull/216) - Fix proj4 radius parameters for spherical cases
+
+In this release 3 pull requests were closed.
+
 ## Version 1.13.0 (2019/09/13)
 
 ### Issues Closed


=====================================
pyresample/geometry.py
=====================================
@@ -36,7 +36,8 @@ from pyproj import Geod, transform
 from pyresample import CHUNK_SIZE
 from pyresample._spatial_mp import Cartesian, Cartesian_MP, Proj, Proj_MP
 from pyresample.boundary import AreaDefBoundary, Boundary, SimpleBoundary
-from pyresample.utils import proj4_str_to_dict, proj4_dict_to_str, convert_proj_floats
+from pyresample.utils import (proj4_str_to_dict, proj4_dict_to_str,
+                              convert_proj_floats, proj4_radius_parameters)
 from pyresample.area_config import create_area_def
 
 try:
@@ -1346,7 +1347,17 @@ class AreaDefinition(BaseDefinition):
     @property
     def proj_str(self):
         """Return PROJ projection string."""
-        return proj4_dict_to_str(self.proj_dict, sort=True)
+        proj_dict = self.proj_dict.copy()
+        if 'towgs84' in proj_dict and isinstance(proj_dict['towgs84'], list):
+            # pyproj 2+ creates a list in the dictionary
+            # but the string should be comma-separated
+            if all(x == 0 for x in proj_dict['towgs84']):
+                # all 0s in towgs84 are technically equal to not having them
+                # specified, but PROJ considers them different
+                proj_dict.pop('towgs84')
+            else:
+                proj_dict['towgs84'] = ','.join(str(x) for x in proj_dict['towgs84'])
+        return proj4_dict_to_str(proj_dict, sort=True)
 
     def __str__(self):
         """Return string representation of the AreaDefinition."""
@@ -1904,8 +1915,9 @@ class AreaDefinition(BaseDefinition):
 def get_geostationary_angle_extent(geos_area):
     """Get the max earth (vs space) viewing angles in x and y."""
     # get some projection parameters
-    req = geos_area.proj_dict['a'] / 1000.0
-    rp = geos_area.proj_dict['b'] / 1000.0
+    a, b = proj4_radius_parameters(geos_area.proj_dict)
+    req = a / 1000.0
+    rp = b / 1000.0
     h = geos_area.proj_dict['h'] / 1000.0 + req
 
     # compute some constants


=====================================
pyresample/test/test_geometry.py
=====================================
@@ -1133,6 +1133,38 @@ class Test(unittest.TestCase):
                 area_extent=[-40000., -40000., 40000., 40000.])
             self.assertEqual(area.proj_str, expected_proj)
 
+        if utils.is_pyproj2():
+            # CRS with towgs84 in it
+            # we remove towgs84 if they are all 0s
+            projection = {'proj': 'laea', 'lat_0': 52, 'lon_0': 10, 'x_0': 4321000, 'y_0': 3210000,
+                          'ellps': 'GRS80', 'towgs84': '0,0,0,0,0,0,0', 'units': 'm', 'no_defs': True}
+            area = geometry.AreaDefinition(
+                area_id='test_towgs84',
+                description='',
+                proj_id='',
+                projection=projection,
+                width=123, height=123,
+                area_extent=[-40000., -40000., 40000., 40000.])
+            self.assertEqual(area.proj_str,
+                             '+ellps=GRS80 +lat_0=52 +lon_0=10 +no_defs +proj=laea '
+                             # '+towgs84=0.0,0.0,0.0,0.0,0.0,0.0,0.0 '
+                             '+type=crs +units=m '
+                             '+x_0=4321000 +y_0=3210000')
+            projection = {'proj': 'laea', 'lat_0': 52, 'lon_0': 10, 'x_0': 4321000, 'y_0': 3210000,
+                          'ellps': 'GRS80', 'towgs84': '0,5,0,0,0,0,0', 'units': 'm', 'no_defs': True}
+            area = geometry.AreaDefinition(
+                area_id='test_towgs84',
+                description='',
+                proj_id='',
+                projection=projection,
+                width=123, height=123,
+                area_extent=[-40000., -40000., 40000., 40000.])
+            self.assertEqual(area.proj_str,
+                             '+ellps=GRS80 +lat_0=52 +lon_0=10 +no_defs +proj=laea '
+                             '+towgs84=0.0,5.0,0.0,0.0,0.0,0.0,0.0 '
+                             '+type=crs +units=m '
+                             '+x_0=4321000 +y_0=3210000')
+
     def test_striding(self):
         """Test striding AreaDefinitions."""
         from pyresample import utils
@@ -1867,6 +1899,13 @@ class TestCrop(unittest.TestCase):
 
         expected = (0.15185342867090912, 0.15133555510297725)
 
+        np.testing.assert_allclose(expected,
+                                   geometry.get_geostationary_angle_extent(geos_area))
+
+        geos_area.proj_dict = {'ellps': 'GRS80',
+                               'h': 35785831.00}
+        expected = (0.15185277703584374, 0.15133971368991794)
+
         np.testing.assert_allclose(expected,
                                    geometry.get_geostationary_angle_extent(geos_area))
 


=====================================
pyresample/test/test_utils.py
=====================================
@@ -330,6 +330,7 @@ class TestMisc(unittest.TestCase):
                            1000, 1000, (-1000, -1000, 1000, 1000))
 
     def test_proj4_radius_parameters_provided(self):
+        """Test proj4_radius_parameters with a/b."""
         from pyresample import utils
         a, b = utils._proj4.proj4_radius_parameters(
             '+proj=stere +a=6378273 +b=6356889.44891',
@@ -338,6 +339,7 @@ class TestMisc(unittest.TestCase):
         np.testing.assert_almost_equal(b, 6356889.44891)
 
     def test_proj4_radius_parameters_ellps(self):
+        """Test proj4_radius_parameters with ellps."""
         from pyresample import utils
         a, b = utils._proj4.proj4_radius_parameters(
             '+proj=stere +ellps=WGS84',
@@ -346,6 +348,7 @@ class TestMisc(unittest.TestCase):
         np.testing.assert_almost_equal(b, 6356752.314245, decimal=6)
 
     def test_proj4_radius_parameters_default(self):
+        """Test proj4_radius_parameters with default parameters."""
         from pyresample import utils
         a, b = utils._proj4.proj4_radius_parameters(
             '+proj=lcc',
@@ -354,6 +357,15 @@ class TestMisc(unittest.TestCase):
         np.testing.assert_almost_equal(a, 6378137.)
         np.testing.assert_almost_equal(b, 6356752.314245, decimal=6)
 
+    def test_proj4_radius_parameters_spherical(self):
+        """Test proj4_radius_parameters in case of a spherical earth."""
+        from pyresample import utils
+        a, b = utils._proj4.proj4_radius_parameters(
+            '+proj=stere +R=6378273',
+        )
+        np.testing.assert_almost_equal(a, 6378273.)
+        np.testing.assert_almost_equal(b, 6378273.)
+
     def test_convert_proj_floats(self):
         from collections import OrderedDict
         import pyresample.utils as utils


=====================================
pyresample/utils/_proj4.py
=====================================
@@ -113,6 +113,9 @@ def proj4_radius_parameters(proj4_dict):
             new_info['b'] = float(new_info['a']) * (1 - float(new_info['f']))
         elif 'b' in new_info and 'f' in new_info:
             new_info['a'] = float(new_info['b']) / (1 - float(new_info['f']))
+        elif 'R' in new_info:
+            new_info['a'] = new_info['R']
+            new_info['b'] = new_info['R']
         else:
             geod = Geod(**{'ellps': 'WGS84'})
             new_info['a'] = geod.a


=====================================
pyresample/version.py
=====================================
@@ -23,9 +23,9 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (HEAD -> master, tag: v1.13.0)"
-    git_full = "790a0bae85cb243c17f0150011e30c834f244e04"
-    git_date = "2019-09-13 08:32:20 +0200"
+    git_refnames = " (HEAD -> master, tag: v1.13.1)"
+    git_full = "d9ff2c9012a4dbfd0f39172fde2e21bb34c04e4a"
+    git_date = "2019-09-26 20:22:21 +0200"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/commit/57ba95072204b4acb2d3d7ada508735c1fb7ce61

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/commit/57ba95072204b4acb2d3d7ada508735c1fb7ce61
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/20190930/6602f479/attachment-0001.html>


More information about the Pkg-grass-devel mailing list