[pyresample] 01/03: New patch for fixing proj4 initialization in unit tests

Antonio Valentino a_valentino-guest at moszumanska.debian.org
Sat Jul 18 10:51:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

a_valentino-guest pushed a commit to branch master
in repository pyresample.

commit e4ab37252d6ba0a093049013c83ca19d7f82923b
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date:   Sat Jul 18 10:35:23 2015 +0000

    New patch for fixing proj4 initialization in unit tests
---
 debian/changelog                                   |   1 +
 debian/patches/0003-fix-proj4-initialization.patch | 196 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 198 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index ea6a995..fb622e5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ pyresample (1.1.3-1) UNRELEASED; urgency=medium
     - new patch for skipping tests that require basemap when it is
       not abailable
     - new patch for fixing sphinx doc building
+    - new patch for fixing proj4 initialization in unittests (closes: #792068)
   * debian/control
     - removed Provides field from the binary package section in the
       control file. It is not necessary
diff --git a/debian/patches/0003-fix-proj4-initialization.patch b/debian/patches/0003-fix-proj4-initialization.patch
new file mode 100644
index 0000000..37cfa89
--- /dev/null
+++ b/debian/patches/0003-fix-proj4-initialization.patch
@@ -0,0 +1,196 @@
+From: Antonio Valentino <antonio.valentino at tiscali.it>
+Date: Sat, 18 Jul 2015 10:33:21 +0000
+Subject: fix proj4 initialization
+
+---
+ pyresample/geometry.py               | 56 +++++++++++++++++++-----------------
+ pyresample/test/test_files/areas.cfg |  2 +-
+ pyresample/test/test_geometry.py     |  8 +++---
+ 3 files changed, 34 insertions(+), 32 deletions(-)
+
+diff --git a/pyresample/geometry.py b/pyresample/geometry.py
+index fa4b977..5e3c82b 100644
+--- a/pyresample/geometry.py
++++ b/pyresample/geometry.py
+@@ -416,21 +416,21 @@ class AreaDefinition(BaseDefinition):
+     """Holds definition of an area.
+ 
+     :Parameters:
+-    area_id : str 
++    area_id : str
+         ID of area
+     name : str
+         Name of area
+-    proj_id : str 
++    proj_id : str
+         ID of projection
+-    proj_dict : dict 
++    proj_dict : dict
+         Dictionary with Proj.4 parameters
+-    x_size : int 
++    x_size : int
+         x dimension in number of pixels
+-    y_size : int     
+-        y dimension in number of pixels    
+-    area_extent : list 
++    y_size : int
++        y dimension in number of pixels
++    area_extent : list
+         Area extent as a list (LL_x, LL_y, UR_x, UR_y)
+-    nprocs : int, optional 
++    nprocs : int, optional
+         Number of processor cores to be used
+     lons : numpy array, optional
+         Grid lons
+@@ -438,37 +438,37 @@ class AreaDefinition(BaseDefinition):
+         Grid lats
+ 
+     :Attributes:
+-    area_id : str         
++    area_id : str
+         ID of area
+     name : str
+         Name of area
+-    proj_id : str         
++    proj_id : str
+         ID of projection
+-    proj_dict : dict        
++    proj_dict : dict
+         Dictionary with Proj.4 parameters
+-    x_size : int          
++    x_size : int
+         x dimension in number of pixels
+-    y_size : int          
++    y_size : int
+         y dimension in number of pixels
+     shape : tuple
+         Corresponding array shape as (rows, cols)
+     size : int
+         Number of points in grid
+-    area_extent : tuple     
++    area_extent : tuple
+         Area extent as a tuple (LL_x, LL_y, UR_x, UR_y)
+-    area_extent_ll : tuple     
++    area_extent_ll : tuple
+         Area extent in lons lats as a tuple (LL_lon, LL_lat, UR_lon, UR_lat)
+-    pixel_size_x : float    
++    pixel_size_x : float
+         Pixel width in projection units
+-    pixel_size_y : float    
++    pixel_size_y : float
+         Pixel height in projection units
+-    pixel_upper_left : list 
++    pixel_upper_left : list
+         Coordinates (x, y) of center of upper left pixel in projection units
+-    pixel_offset_x : float 
+-        x offset between projection center and upper left corner of upper 
++    pixel_offset_x : float
++        x offset between projection center and upper left corner of upper
+         left pixel in units of pixels.
+-    pixel_offset_y : float 
+-        y offset between projection center and upper left corner of upper 
++    pixel_offset_y : float
++        y offset between projection center and upper left corner of upper
+         left pixel in units of pixels..
+ 
+     Properties:
+@@ -511,6 +511,8 @@ class AreaDefinition(BaseDefinition):
+         self.area_extent = tuple(area_extent)
+ 
+         # Calculate area_extent in lon lat
++        from pprint import pprint
++        pprint(proj_dict)
+         proj = _spatial_mp.Proj(**proj_dict)
+         corner_lons, corner_lats = proj((area_extent[0], area_extent[2]),
+                                         (area_extent[1], area_extent[3]),
+@@ -635,7 +637,7 @@ class AreaDefinition(BaseDefinition):
+         return self.get_lonlats(nprocs=None, data_slice=(row, col))
+ 
+     def get_proj_coords(self, data_slice=None, cache=False, dtype=None):
+-        """Get projection coordinates of grid 
++        """Get projection coordinates of grid
+ 
+         :Parameters:
+         data_slice : slice object, optional
+@@ -643,7 +645,7 @@ class AreaDefinition(BaseDefinition):
+         cache : bool, optional
+             Store result the result. Requires data_slice to be None
+ 
+-        :Returns: 
++        :Returns:
+         (target_x, target_y) : tuple of numpy arrays
+             Grids of area x- and y-coordinates in projection units
+         """
+@@ -778,8 +780,8 @@ class AreaDefinition(BaseDefinition):
+     def get_lonlats(self, nprocs=None, data_slice=None, cache=False, dtype=None):
+         """Returns lon and lat arrays of area.
+ 
+-        :Parameters:        
+-        nprocs : int, optional 
++        :Parameters:
++        nprocs : int, optional
+             Number of processor cores to be used.
+             Defaults to the nprocs set when instantiating object
+         data_slice : slice object, optional
+@@ -787,7 +789,7 @@ class AreaDefinition(BaseDefinition):
+         cache : bool, optional
+             Store result the result. Requires data_slice to be None
+ 
+-        :Returns: 
++        :Returns:
+         (lons, lats) : tuple of numpy arrays
+             Grids of area lons and and lats
+         """
+diff --git a/pyresample/test/test_files/areas.cfg b/pyresample/test/test_files/areas.cfg
+index 3c6ef3c..5346cb4 100644
+--- a/pyresample/test/test_files/areas.cfg
++++ b/pyresample/test/test_files/areas.cfg
+@@ -19,7 +19,7 @@ REGION: ease_nh {
+ REGION: pc_world {
+   NAME:    Plate Carree world map
+   PCS_ID:  pc_world
+-  PCS_DEF: proj=eqc
++  PCS_DEF: proj=eqc, ellps=WGS84
+   XSIZE: 640
+   YSIZE: 480
+   AREA_EXTENT:  (-20037508.342789244, -10018754.171394622, 20037508.342789244, 10018754.171394622)
+diff --git a/pyresample/test/test_geometry.py b/pyresample/test/test_geometry.py
+index bba33ee..f2d8897 100644
+--- a/pyresample/test/test_geometry.py
++++ b/pyresample/test/test_geometry.py
+@@ -414,7 +414,7 @@ class Test(unittest.TestCase):
+         swath_def = geometry.SwathDefinition(lons, lats)
+         filter_area = geometry.AreaDefinition('test', 'test', 'test',
+                                               {'proj': 'eqc', 'lon_0': 0.0,
+-                                                  'lat_0': 0.0},
++                                                  'lat_0': 0.0, 'ellps': 'WGS84'},
+                                               8, 8,
+                                               (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
+         filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
+@@ -439,7 +439,7 @@ class Test(unittest.TestCase):
+         data = np.array([1, 2, 3, 4])
+         filter_area = geometry.AreaDefinition('test', 'test', 'test',
+                                               {'proj': 'eqc', 'lon_0': 0.0,
+-                                                  'lat_0': 0.0},
++                                                  'lat_0': 0.0, 'ellps': 'WGS84'},
+                                               8, 8,
+                                               (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
+         filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
+@@ -474,7 +474,7 @@ class Test(unittest.TestCase):
+         data = np.dstack((data1, data2, data3))
+         filter_area = geometry.AreaDefinition('test', 'test', 'test',
+                                               {'proj': 'eqc', 'lon_0': 0.0,
+-                                                  'lat_0': 0.0},
++                                                  'lat_0': 0.0, 'ellps': 'WGS84'},
+                                               8, 8,
+                                               (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
+         filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
+@@ -544,7 +544,7 @@ class Test(unittest.TestCase):
+     @tmp
+     def test_latlong_area(self):
+         area_def = geometry.AreaDefinition('', '', '',
+-                                           {'proj': 'latlong'},
++                                           {'proj': 'latlong', 'ellps': 'WGS84'},
+                                            360, 180,
+                                            [-180, -90, 180, 90])
+         lons, lats = area_def.get_lonlats()
diff --git a/debian/patches/series b/debian/patches/series
index 1dfa346..217142d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-skip-basemap-tests.patch
 0002-fix-doc-build.patch
+0003-fix-proj4-initialization.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pyresample.git



More information about the Pkg-grass-devel mailing list