[Git][debian-gis-team/satpy][master] 3 commits: Fix compatibility with latest proj
Antonio Valentino
gitlab at salsa.debian.org
Mon Sep 16 22:34:27 BST 2019
Antonio Valentino pushed to branch master at Debian GIS Project / satpy
Commits:
037d2f22 by Antonio Valentino at 2019-09-16T21:27:29Z
Fix compatibility with latest proj
- - - - -
9d079720 by Antonio Valentino at 2019-09-16T21:32:55Z
Remove obsolete fields Name, Contact from debian/upstream/metadata.
- - - - -
5b8e7bd9 by Antonio Valentino at 2019-09-16T21:33:47Z
Set distribution to unstable
- - - - -
4 changed files:
- debian/changelog
- + debian/patches/0006-Fix-compatibility-with-new-proj-version.patch
- debian/patches/series
- debian/upstream/metadata
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+satpy (0.16.1-3) unstable; urgency=medium
+
+ * debian/patches:
+ - new 0006-Fix-compatibility-with-new-proj-version.patch
+ (backport form upstream)
+ * Remove obsolete fields Name, Contact from debian/upstream/metadata.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Mon, 16 Sep 2019 21:33:09 +0000
+
satpy (0.16.1-2) unstable; urgency=medium
* Use debhelper-compat instead of debian/compat.
=====================================
debian/patches/0006-Fix-compatibility-with-new-proj-version.patch
=====================================
@@ -0,0 +1,202 @@
+From: Antonio Valentino <antonio.valentino at tiscali.it>
+Date: Mon, 16 Sep 2019 21:23:46 +0000
+Subject: Fix compatibility with new proj version
+
+Backport form upstream master (13892290b02456b04432e4fb86d9e85dad8d2990).
+---
+ satpy/tests/reader_tests/test_ahi_hsd.py | 22 +++++++++++++--------
+ satpy/tests/reader_tests/test_hrit_base.py | 13 ++++++------
+ satpy/tests/reader_tests/test_seviri_l1b_hrit.py | 13 ++++++------
+ satpy/tests/test_config.py | 25 +++++++++++++++++++++---
+ satpy/tests/writer_tests/test_cf.py | 10 ++++++++--
+ satpy/writers/mitiff.py | 14 +++++++++----
+ 6 files changed, 68 insertions(+), 29 deletions(-)
+
+diff --git a/satpy/tests/reader_tests/test_ahi_hsd.py b/satpy/tests/reader_tests/test_ahi_hsd.py
+index e74bbfe..2335bee 100644
+--- a/satpy/tests/reader_tests/test_ahi_hsd.py
++++ b/satpy/tests/reader_tests/test_ahi_hsd.py
+@@ -71,10 +71,13 @@ class TestAHIHSDNavigation(unittest.TestCase):
+ 'spare': ''}
+
+ area_def = fh.get_area_def(None)
+- self.assertEqual(area_def.proj_dict, {'a': 6378137.0, 'b': 6356752.3,
+- 'h': 35785863.0, 'lon_0': 140.7,
+- 'proj': 'geos', 'units': 'm'})
+-
++ proj_dict = area_def.proj_dict
++ self.assertEqual(proj_dict['a'], 6378137.0)
++ self.assertEqual(proj_dict['b'], 6356752.3)
++ self.assertEqual(proj_dict['h'], 35785863.0)
++ self.assertEqual(proj_dict['lon_0'], 140.7)
++ self.assertEqual(proj_dict['proj'], 'geos')
++ self.assertEqual(proj_dict['units'], 'm')
+ self.assertEqual(area_def.area_extent, (592000.0038256244, 4132000.026701824,
+ 1592000.0102878278, 5132000.033164027))
+
+@@ -113,10 +116,13 @@ class TestAHIHSDNavigation(unittest.TestCase):
+ 'spare': ''}
+
+ area_def = fh.get_area_def(None)
+- self.assertEqual(area_def.proj_dict, {'a': 6378137.0, 'b': 6356752.3,
+- 'h': 35785863.0, 'lon_0': 140.7,
+- 'proj': 'geos', 'units': 'm'})
+-
++ proj_dict = area_def.proj_dict
++ self.assertEqual(proj_dict['a'], 6378137.0)
++ self.assertEqual(proj_dict['b'], 6356752.3)
++ self.assertEqual(proj_dict['h'], 35785863.0)
++ self.assertEqual(proj_dict['lon_0'], 140.7)
++ self.assertEqual(proj_dict['proj'], 'geos')
++ self.assertEqual(proj_dict['units'], 'm')
+ self.assertEqual(area_def.area_extent, (-5500000.035542117, -3300000.021325271,
+ 5500000.035542117, -2200000.0142168473))
+
+diff --git a/satpy/tests/reader_tests/test_hrit_base.py b/satpy/tests/reader_tests/test_hrit_base.py
+index 50d3ae0..631228f 100644
+--- a/satpy/tests/reader_tests/test_hrit_base.py
++++ b/satpy/tests/reader_tests/test_hrit_base.py
+@@ -142,12 +142,13 @@ class TestHRITFileHandler(unittest.TestCase):
+
+ def test_get_area_def(self):
+ area = self.reader.get_area_def('VIS06')
+- self.assertEqual(area.proj_dict, {'a': 6378169.0,
+- 'b': 6356583.8,
+- 'h': 35785831.0,
+- 'lon_0': 44.0,
+- 'proj': 'geos',
+- 'units': 'm'})
++ proj_dict = area.proj_dict
++ self.assertEqual(proj_dict['a'], 6378169.0)
++ self.assertEqual(proj_dict['b'], 6356583.8)
++ self.assertEqual(proj_dict['h'], 35785831.0)
++ self.assertEqual(proj_dict['lon_0'], 44.0)
++ self.assertEqual(proj_dict['proj'], 'geos')
++ self.assertEqual(proj_dict['units'], 'm')
+ self.assertEqual(area.area_extent,
+ (-77771774058.38356, -77771774058.38356,
+ 30310525626438.438, 3720765401003.719))
+diff --git a/satpy/tests/reader_tests/test_seviri_l1b_hrit.py b/satpy/tests/reader_tests/test_seviri_l1b_hrit.py
+index c601c23..f34574c 100644
+--- a/satpy/tests/reader_tests/test_seviri_l1b_hrit.py
++++ b/satpy/tests/reader_tests/test_seviri_l1b_hrit.py
+@@ -134,12 +134,13 @@ class TestHRITMSGFileHandler(unittest.TestCase):
+
+ def test_get_area_def(self):
+ area = self.reader.get_area_def(DatasetID('VIS006'))
+- self.assertEqual(area.proj_dict, {'a': 6378169.0,
+- 'b': 6356583.8,
+- 'h': 35785831.0,
+- 'lon_0': 44.0,
+- 'proj': 'geos',
+- 'units': 'm'})
++ proj_dict = area.proj_dict
++ self.assertEqual(proj_dict['a'], 6378169.0)
++ self.assertEqual(proj_dict['b'], 6356583.8)
++ self.assertEqual(proj_dict['h'], 35785831.0)
++ self.assertEqual(proj_dict['lon_0'], 44.0)
++ self.assertEqual(proj_dict['proj'], 'geos')
++ self.assertEqual(proj_dict['units'], 'm')
+ self.assertEqual(area.area_extent,
+ (-77771774058.38356, -3720765401003.719,
+ 30310525626438.438, 77771774058.38356))
+diff --git a/satpy/tests/test_config.py b/satpy/tests/test_config.py
+index 2b53836..b3b6d24 100644
+--- a/satpy/tests/test_config.py
++++ b/satpy/tests/test_config.py
+@@ -79,13 +79,32 @@ class TestBuiltinAreas(unittest.TestCase):
+ return unittest.skip("RasterIO 1.0+ required")
+
+ from pyresample import parse_area_file
++ from pyresample.geometry import SwathDefinition
+ from satpy.resample import get_area_file
++ import numpy as np
++ import xarray as xr
++
++ lons = np.array([[0, 0.1, 0.2], [0.05, 0.15, 0.25]])
++ lats = np.array([[0, 0.1, 0.2], [0.05, 0.15, 0.25]])
++ lons = xr.DataArray(lons)
++ lats = xr.DataArray(lats)
++ swath_def = SwathDefinition(lons, lats)
+ all_areas = parse_area_file(get_area_file())
+ for area_obj in all_areas:
+- if getattr(area_obj, 'optimize_projection', False):
+- # the PROJ.4 is known to not be valid on this DynamicAreaDef
+- continue
++ if hasattr(area_obj, 'freeze'):
++ try:
++ area_obj = area_obj.freeze(lonslats=swath_def)
++ except RuntimeError:
++ # we didn't provide enough info to freeze, hard to guess
++ # in a generic test so just skip this area
++ continue
+ proj_dict = area_obj.proj_dict
++ if proj_dict.get('proj') in ('ob_tran', 'nsper') and \
++ 'wktext' not in proj_dict:
++ # FIXME: rasterio doesn't understand ob_tran unless +wktext
++ # See: https://github.com/pyproj4/pyproj/issues/357
++ # pyproj 2.0+ seems to drop wktext from PROJ dict
++ continue
+ _ = CRS.from_dict(proj_dict)
+
+
+diff --git a/satpy/tests/writer_tests/test_cf.py b/satpy/tests/writer_tests/test_cf.py
+index 2f7fc63..c4721d0 100644
+--- a/satpy/tests/writer_tests/test_cf.py
++++ b/satpy/tests/writer_tests/test_cf.py
+@@ -712,8 +712,14 @@ class TestCFWriter(unittest.TestCase):
+ with mock.patch('satpy.writers.cf_writer.warnings.warn') as warn:
+ res, grid_mapping = area2gridmapping(ds)
+ warn.assert_called()
+- self.assertDictEqual(dict(pyresample.geometry.proj4_str_to_dict(res.attrs['grid_proj4'])),
+- dict(pyresample.geometry.proj4_str_to_dict(proj_str)))
++ proj_dict = pyresample.geometry.proj4_str_to_dict(res.attrs['grid_proj4'])
++ self.assertEqual(proj_dict['lon_0'], 4.535)
++ self.assertEqual(proj_dict['lat_0'], 46.0)
++ self.assertEqual(proj_dict['o_lon_p'], -5.465)
++ self.assertEqual(proj_dict['o_lat_p'], 90.0)
++ self.assertEqual(proj_dict['proj'], 'ob_tran')
++ self.assertEqual(proj_dict['o_proj'], 'stere')
++ self.assertEqual(proj_dict['ellps'], 'WGS84')
+ self.assertEqual(grid_mapping, cosmo_expected)
+
+ def test_area2lonlat(self):
+diff --git a/satpy/writers/mitiff.py b/satpy/writers/mitiff.py
+index 47a32d0..da45738 100644
+--- a/satpy/writers/mitiff.py
++++ b/satpy/writers/mitiff.py
+@@ -203,9 +203,15 @@ class MITIFFWriter(ImageWriter):
+ proj4_string = " Proj string: "
+
+ if isinstance(datasets, list):
+- proj4_string += first_dataset.attrs['area'].proj4_string
++ area = first_dataset.attrs['area']
+ else:
+- proj4_string += datasets.attrs['area'].proj4_string
++ area = datasets.attrs['area']
++ # Use pyproj's CRS object to get a valid EPSG code if possible
++ # only in newer pyresample versions with pyproj 2.0+ installed
++ if hasattr(area, 'crs') and area.crs.to_epsg() is not None:
++ proj4_string += "+init=EPSG:{}".format(area.crs.to_epsg())
++ else:
++ proj4_string += area.proj_str
+
+ x_0 = 0
+ y_0 = 0
+@@ -246,14 +252,14 @@ class MITIFFWriter(ImageWriter):
+ if 'units' not in proj4_string:
+ proj4_string += ' +units=km'
+
+- if isinstance(datasets, list):
++ if 'x_0' not in proj4_string and isinstance(datasets, list):
+ proj4_string += ' +x_0=%.6f' % (
+ (-first_dataset.attrs['area'].area_extent[0] +
+ first_dataset.attrs['area'].pixel_size_x) + x_0)
+ proj4_string += ' +y_0=%.6f' % (
+ (-first_dataset.attrs['area'].area_extent[1] +
+ first_dataset.attrs['area'].pixel_size_y) + y_0)
+- else:
++ elif 'x_0' not in proj4_string:
+ proj4_string += ' +x_0=%.6f' % (
+ (-datasets.attrs['area'].area_extent[0] +
+ datasets.attrs['area'].pixel_size_x) + x_0)
=====================================
debian/patches/series
=====================================
@@ -3,3 +3,4 @@
0003-Explicitly-set-chunks-in-dask-arrays.patch
0004-Disable-tests-on-the-number-of-calls-to-ll2cr.patch
0005-Fix-test_gaclacfile.patch
+0006-Fix-compatibility-with-new-proj-version.patch
=====================================
debian/upstream/metadata
=====================================
@@ -1,6 +1,4 @@
Bug-Database: https://github.com/pytroll/satpy/issues
Bug-Submit: https://github.com/pytroll/satpy/issues/new
-Contact: The Pytroll Team <pytroll at googlegroups.com>
-Name: satpy
Repository: https://github.com/pytroll/satpy.git
Repository-Browse: https://github.com/pytroll/satpy
View it on GitLab: https://salsa.debian.org/debian-gis-team/satpy/compare/828c14f16b8394c161c7a265c9c55029c2386aeb...5b8e7bd9d2eca2ddd5338db90acbbd7ca29c900f
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/satpy/compare/828c14f16b8394c161c7a265c9c55029c2386aeb...5b8e7bd9d2eca2ddd5338db90acbbd7ca29c900f
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/20190916/ea792c71/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list