[Git][debian-gis-team/pyresample][master] 6 commits: New upstream version 1.8.3

Antonio Valentino gitlab at salsa.debian.org
Fri Mar 23 07:41:29 UTC 2018


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


Commits:
a134a6d7 by Antonio Valentino at 2018-03-23T07:03:24+00:00
New upstream version 1.8.3
- - - - -
d891fe89 by Antonio Valentino at 2018-03-23T07:03:38+00:00
Update upstream source from tag 'upstream/1.8.3'

Update to upstream version '1.8.3'
with Debian dir 625e26eaaf4cc0c259cb928e4e56e4595c015b62
- - - - -
8206087b by Antonio Valentino at 2018-03-23T07:09:00+00:00
New upstream release

- - - - -
3fa90ed1 by Antonio Valentino at 2018-03-23T07:10:41+00:00
Refresh all patches

- - - - -
66b468ae by Antonio Valentino at 2018-03-23T07:28:20+00:00
Update Vcs-* fields to point to salsa

- - - - -
bb6f4b2c by Antonio Valentino at 2018-03-23T07:39:32+00:00
Set distribution to unstable

- - - - -


13 changed files:

- .bumpversion.cfg
- + .stickler.yml
- appveyor.yml
- changelog.rst
- debian/changelog
- debian/control
- debian/patches/0002-fix-proj4-initialization.patch
- pyresample/__init__.py
- pyresample/geometry.py
- pyresample/kd_tree.py
- pyresample/test/test_geometry.py
- pyresample/version.py
- setup.py


Changes:

=====================================
.bumpversion.cfg
=====================================
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 1.8.2
+current_version = 1.8.3
 commit = True
 tag = True
 


=====================================
.stickler.yml
=====================================
--- /dev/null
+++ b/.stickler.yml
@@ -0,0 +1,5 @@
+linters:
+  flake8:
+    fixer: true
+fixers:
+  enable: true


=====================================
appveyor.yml
=====================================
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -64,7 +64,7 @@ install:
   # target Python version and architecture
   - "conda update --yes conda"
   - "conda config --add channels conda-forge"
-  - "conda create -q --yes -n test python=%PYTHON_VERSION% basemap-data-hires sphinx pyproj scipy pykdtree"
+  - "conda create -q --yes -n test python=%PYTHON_VERSION% basemap-data-hires sphinx pyproj scipy pykdtree dask xarray"
   - "activate test"
   - "pip install coveralls"
   - "pip install mock"


=====================================
changelog.rst
=====================================
--- a/changelog.rst
+++ b/changelog.rst
@@ -2,6 +2,37 @@ Changelog
 =========
 
 
+v1.8.3 (2018-03-19)
+-------------------
+- update changelog. [Martin Raspaud]
+- Bump version: 1.8.2 → 1.8.3. [Martin Raspaud]
+- Merge branch 'develop' into new_release. [Martin Raspaud]
+- Merge pull request #107 from pytroll/bugfix-memory-leak. [Martin
+  Raspaud]
+
+  [WIP] Remove closures to allow memory to be freed
+- Prevend dynamic areas to choke on NaNs. [Martin Raspaud]
+- Make CHUNK_SIZE int if taken from environment. [Martin Raspaud]
+- Reorganize indices assignments. [Martin Raspaud]
+- Remove closures to allow memory to be freed. [Martin Raspaud]
+- Merge pull request #106 from pytroll/bugfix-area-equality. [David
+  Hoese]
+
+  Fix area equality to support np.nan, xarray and dask
+- Add dask and xarray to appveyor. [Martin Raspaud]
+- Use numpy's allclose for swathdef equality. [Martin Raspaud]
+- Require a newer numpy for nan equality. [Martin Raspaud]
+- Style cleanup. [Martin Raspaud]
+- Add tests for swath equality. [Martin Raspaud]
+- Style cleanup. [Martin Raspaud]
+- Fix area equality to support xarray and dask. [Martin Raspaud]
+- Merge pull request #108 from pytroll/add-stickler-config. [Martin
+  Raspaud]
+
+  Adding .stickler.yml configuration file
+- Adding .stickler.yml. [stickler-ci]
+
+
 v1.8.2 (2018-03-01)
 -------------------
 - update changelog. [davidh-ssec]
@@ -738,7 +769,6 @@ v1.2.2 (2016-06-21)
   Without this, the compilation of the ewa extension crashes.
 
 
-
 v1.2.1 (2016-06-21)
 -------------------
 - update changelog. [Martin Raspaud]
@@ -894,11 +924,9 @@ v1.2.0 (2016-06-17)
 - Make kd_tree test work on older numpy version. [Martin Raspaud]
 
   VisibleDeprecationWarning is not available in numpy <1.9.
-
 - Adapt to newest pykdtree version. [Martin Raspaud]
 
   The kdtree object's attribute `data_pts` has been renamed to `data`.
-
 - Run tests on python 3.5 in travis also. [Martin Raspaud]
 
 
@@ -910,7 +938,6 @@ v1.1.6 (2016-02-25)
 
   A previous commit was looking for a 'data_pts' attribute in the kdtree
   object, which is available in pykdtree, but not scipy.
-
 - Merge pull request #32 from mitkin/master. [Martin Raspaud]
 
   [tests] Skip deprecation warnings in test_gauss_multi_uncert
@@ -922,7 +949,6 @@ v1.1.6 (2016-02-25)
   The latest matplotlib (1.5) doesn't support python 2.6 and 3.3. This patch
   chooses the right matplotlib version to install depending on the python
   version at hand.
-
 - Skip deprecation warnings. [Mikhail Itkin]
 
   Catch the rest of the warnings. Check if there is only one, and
@@ -964,7 +990,6 @@ Other
 - Bugfix to address a numpy DeprecationWarning. [Martin Raspaud]
 
   Numpy won't take non-integer indices soon, so make index an int.
-
 - Merge branch 'release-1.1.3' [Martin Raspaud]
 - Merge branch 'licence-lgpl' into pre-master. [Martin Raspaud]
 - Switch to lgplv3, and bump up version number. [Martin Raspaud]
@@ -1186,7 +1211,7 @@ Other
 - Set svn:mime-type. [StorPipfugl]
 - Corrected doc errors. [StorPipfugl]
 - Removed dist dir. [StorPipfugl]
--  [StorPipfugl]
+- No commit message. [StorPipfugl]
 - Updated documentation. New release. [StorPipfugl]
 - Started updating docstrings. [StorPipfugl]
 - Restructured API. [StorPipfugl]
@@ -1199,8 +1224,9 @@ Other
 - Removed unneeded function. [StorPipfugl]
 - Mime types set. [StorPipfugl]
 - Mime types set. [StorPipfugl]
--  [StorPipfugl]
+- No commit message. [StorPipfugl]
 - Moved to Google Code under GPLv3 license. [StorPipfugl]
 - moved to Google Code. [StorPipfugl]
 
 
+


=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+pyresample (1.8.3-1) unstable; urgency=medium
+
+  * New upstream release
+  * debian/patches
+    - refresh all patches
+  * debian/control
+    - update Vcs-* fields to point to salsa
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Fri, 23 Mar 2018 07:28:30 +0000
+
 pyresample (1.8.2-1) unstable; urgency=medium
 
   * New upstream release


=====================================
debian/control
=====================================
--- a/debian/control
+++ b/debian/control
@@ -32,8 +32,8 @@ Build-Depends: debhelper (>= 11.0.0),
                cython,
                cython3
 Standards-Version: 4.1.3
-Vcs-Browser: https://anonscm.debian.org/cgit/pkg-grass/pyresample.git
-Vcs-Git: https://anonscm.debian.org/git/pkg-grass/pyresample.git
+Vcs-Browser: https://salsa.debian.org/debian-gis-team/pyresample
+Vcs-Git: https://salsa.debian.org/debian-gis-team/pyresample.git
 Homepage: https://github.com/pytroll/pyresample
 
 Package: python-pyresample


=====================================
debian/patches/0002-fix-proj4-initialization.patch
=====================================
--- a/debian/patches/0002-fix-proj4-initialization.patch
+++ b/debian/patches/0002-fix-proj4-initialization.patch
@@ -21,10 +21,10 @@ index 3c6ef3c..5346cb4 100644
    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 ae8990b..3befc7d 100644
+index ef060d4..c35f304 100644
 --- a/pyresample/test/test_geometry.py
 +++ b/pyresample/test/test_geometry.py
-@@ -406,7 +406,7 @@ class Test(unittest.TestCase):
+@@ -389,7 +389,7 @@ class Test(unittest.TestCase):
          swath_def = geometry.SwathDefinition(lons, lats)
          filter_area = geometry.AreaDefinition('test', 'test', 'test',
                                                {'proj': 'eqc', 'lon_0': 0.0,
@@ -33,7 +33,7 @@ index ae8990b..3befc7d 100644
                                                8, 8,
                                                (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
          filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
-@@ -431,7 +431,7 @@ class Test(unittest.TestCase):
+@@ -414,7 +414,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,
@@ -42,7 +42,7 @@ index ae8990b..3befc7d 100644
                                                8, 8,
                                                (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
          filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
-@@ -466,7 +466,7 @@ class Test(unittest.TestCase):
+@@ -449,7 +449,7 @@ class Test(unittest.TestCase):
          data = np.dstack((data1, data2, data3))
          filter_area = geometry.AreaDefinition('test', 'test', 'test',
                                                {'proj': 'eqc', 'lon_0': 0.0,
@@ -51,7 +51,7 @@ index ae8990b..3befc7d 100644
                                                8, 8,
                                                (-20037508.34, -10018754.17, 20037508.34, 10018754.17))
          filter = np.array([[1, 1, 1, 1, 0, 0, 0, 0],
-@@ -535,7 +535,7 @@ class Test(unittest.TestCase):
+@@ -518,7 +518,7 @@ class Test(unittest.TestCase):
  
      def test_latlong_area(self):
          area_def = geometry.AreaDefinition('', '', '',


=====================================
pyresample/__init__.py
=====================================
--- a/pyresample/__init__.py
+++ b/pyresample/__init__.py
@@ -17,23 +17,22 @@
 
 import os
 
-CHUNK_SIZE = os.getenv('PYTROLL_CHUNK_SIZE', 4096)
+CHUNK_SIZE = int(os.getenv('PYTROLL_CHUNK_SIZE', 4096))
 
-from pyresample.version import __version__
 # Backwards compatibility
-from pyresample import geometry
-from pyresample import grid
-from pyresample import image
-from pyresample import kd_tree
-from pyresample import utils
-from pyresample import plot
+from pyresample import geometry  # noqa
+from pyresample import grid  # noqa
+from pyresample import image  # noqa
+from pyresample import kd_tree  # noqa
+from pyresample import utils  # noqa
+from pyresample import plot  # noqa
 # Easy access
-from pyresample.geometry import (SwathDefinition,
-                                 AreaDefinition,
-                                 DynamicAreaDefinition)
-from pyresample.utils import load_area
-from pyresample.kd_tree import XArrayResamplerNN
-from pyresample.plot import save_quicklook, area_def2basemap
+from pyresample.geometry import (SwathDefinition,  # noqa
+                                 AreaDefinition,  # noqa
+                                 DynamicAreaDefinition)  # noqa
+from pyresample.utils import load_area  # noqa
+from pyresample.kd_tree import XArrayResamplerNN  # noqa
+from pyresample.plot import save_quicklook, area_def2basemap  # noqa
 
 __all__ = ['grid', 'image', 'kd_tree',
            'utils', 'plot', 'geo_filter', 'geometry', 'CHUNK_SIZE']
@@ -43,13 +42,13 @@ def get_capabilities():
     cap = {}
 
     try:
-        from pykdtree.kdtree import KDTree
+        from pykdtree.kdtree import KDTree  # noqa
         cap['pykdtree'] = True
     except ImportError:
         cap['pykdtree'] = False
 
     try:
-        import numexpr
+        import numexpr  # noqa
         cap['numexpr'] = True
     except ImportError:
         cap['numexpr'] = False


=====================================
pyresample/geometry.py
=====================================
--- a/pyresample/geometry.py
+++ b/pyresample/geometry.py
@@ -93,7 +93,8 @@ class BaseDefinition(object):
 
     def __eq__(self, other):
         """Test for approximate equality"""
-
+        if self is other:
+            return True
         if other.lons is None or other.lats is None:
             other_lons, other_lats = other.get_lonlats()
         else:
@@ -106,11 +107,21 @@ class BaseDefinition(object):
             self_lons = self.lons
             self_lats = self.lats
 
+        if self_lons is other_lons and self_lats is other_lats:
+            return True
+        if isinstance(self_lons, DataArray) and np.ndarray is not DataArray:
+            self_lons = self_lons.data
+            self_lats = self_lats.data
+        if isinstance(other_lons, DataArray) and np.ndarray is not DataArray:
+            other_lons = other_lons.data
+            other_lats = other_lats.data
+        try:
+            from dask.array import allclose
+        except ImportError:
+            from numpy import allclose
         try:
-            return (np.allclose(self_lons, other_lons, atol=1e-6,
-                                rtol=5e-9) and
-                    np.allclose(self_lats, other_lats, atol=1e-6,
-                                rtol=5e-9))
+            return (allclose(self_lons, other_lons, atol=1e-6, rtol=5e-9, equal_nan=True) and
+                    allclose(self_lats, other_lats, atol=1e-6, rtol=5e-9, equal_nan=True))
         except (AttributeError, ValueError):
             return False
 
@@ -679,7 +690,10 @@ class DynamicAreaDefinition(object):
             except (TypeError, ValueError):
                 lons, lats = lonslats.get_lonlats()
             xarr, yarr = proj4(np.asarray(lons), np.asarray(lats))
-            corners = [np.min(xarr), np.min(yarr), np.max(xarr), np.max(yarr)]
+            xarr[xarr > 9e29] = np.nan
+            yarr[yarr > 9e29] = np.nan
+            corners = [np.nanmin(xarr), np.nanmin(yarr),
+                       np.nanmax(xarr), np.nanmax(yarr)]
 
             domain = self.compute_domain(corners, resolution, size)
             self.area_extent, self.x_size, self.y_size = domain
@@ -689,6 +703,13 @@ class DynamicAreaDefinition(object):
                               self.area_extent, self.rotation)
 
 
+def invproj(data_x, data_y, proj_dict):
+    """Perform inverse projection."""
+    # XXX: does pyproj copy arrays? What can we do so it doesn't?
+    target_proj = Proj(**proj_dict)
+    return np.dstack(target_proj(data_x, data_y, inverse=True))
+
+
 class AreaDefinition(BaseDefinition):
 
     """Holds definition of an area.
@@ -1229,15 +1250,9 @@ class AreaDefinition(BaseDefinition):
         dtype = dtype or self.dtype
         target_x, target_y = self.get_proj_coords_dask(chunks, dtype)
 
-        target_proj = Proj(**self.proj_dict)
-
-        def invproj(data1, data2):
-            # XXX: does pyproj copy arrays? What can we do so it doesn't?
-            return np.dstack(target_proj(data1, data2, inverse=True))
-
         res = map_blocks(invproj, target_x, target_y,
                          chunks=(target_x.chunks[0], target_x.chunks[1], 2),
-                         new_axis=[2])
+                         new_axis=[2], proj_dict=self.proj_dict)
 
         return res[:, :, 0], res[:, :, 1]
 


=====================================
pyresample/kd_tree.py
=====================================
--- a/pyresample/kd_tree.py
+++ b/pyresample/kd_tree.py
@@ -38,9 +38,7 @@ except ImportError:
     DataArray = None
     da = None
 
-if sys.version < '3':
-    range = xrange
-else:
+if sys.version >= '3':
     long = int
 
 kd_tree_name = None
@@ -177,7 +175,7 @@ def resample_gauss(source_geo_def, data, target_geo_def,
         sigmas.__iter__()
         sigma_list = sigmas
         is_multi_channel = True
-    except:
+    except:  # noqa: E722
         sigma_list = [sigmas]
 
     for sigma in sigma_list:
@@ -250,7 +248,7 @@ def resample_custom(source_geo_def, data, target_geo_def,
         for weight_func in weight_funcs:
             if not isinstance(weight_func, types.FunctionType):
                 raise TypeError('weight_func must be function object')
-    except:
+    except:  # noqa: E722
         if not isinstance(weight_funcs, types.FunctionType):
             raise TypeError('weight_func must be function object')
 
@@ -685,7 +683,7 @@ def get_sample_from_neighbour_info(resample_type, output_shape, data,
                         'valid_input_index and data')
 
     valid_types = ('nn', 'custom')
-    if not resample_type in valid_types:
+    if resample_type not in valid_types:
         raise TypeError('Invalid resampling type: %s' % resample_type)
 
     if resample_type == 'custom' and weight_funcs is None:
@@ -905,7 +903,45 @@ def get_sample_from_neighbour_info(resample_type, output_shape, data,
         return result
 
 
-class XArrayResamplerNN(object):
+def lonlat2xyz(lons, lats):
+
+    R = 6370997.0
+    x_coords = R * da.cos(da.deg2rad(lats)) * da.cos(da.deg2rad(lons))
+    y_coords = R * da.cos(da.deg2rad(lats)) * da.sin(da.deg2rad(lons))
+    z_coords = R * da.sin(da.deg2rad(lats))
+
+    return da.stack(
+        (x_coords.ravel(), y_coords.ravel(), z_coords.ravel()), axis=-1)
+
+
+def query_no_distance(target_lons, target_lats,
+                      valid_output_index, kdtree, neighbours, epsilon, radius):
+    """Query the kdtree. No distances are returned."""
+    voi = valid_output_index
+    shape = voi.shape
+    voir = voi.ravel()
+    target_lons_valid = target_lons.ravel()[voir]
+    target_lats_valid = target_lats.ravel()[voir]
+
+    coords = lonlat2xyz(target_lons_valid, target_lats_valid)
+    distance_array, index_array = kdtree.query(
+        coords.compute(),
+        k=neighbours,
+        eps=epsilon,
+        distance_upper_bound=radius)
+
+    # KDTree query returns out-of-bounds neighbors as `len(arr)`
+    # which is an invalid index, we mask those out so -1 represents
+    # invalid values
+    # voi is 2D, index_array is 1D
+    good_pixels = index_array < kdtree.n
+    voi[voi] = good_pixels
+    res_ia = np.full(shape, fill_value=-1, dtype=np.int)
+    res_ia[voi] = index_array[good_pixels]
+    return res_ia
+
+
+class XArrayResamplerNN():
     def __init__(self,
                  source_geo_def,
                  target_geo_def,
@@ -954,15 +990,6 @@ class XArrayResamplerNN(object):
         self.target_geo_def = target_geo_def
         self.radius_of_influence = radius_of_influence
 
-    def transform_lonlats(self, lons, lats):
-        R = 6370997.0
-        x_coords = R * da.cos(da.deg2rad(lats)) * da.cos(da.deg2rad(lons))
-        y_coords = R * da.cos(da.deg2rad(lats)) * da.sin(da.deg2rad(lons))
-        z_coords = R * da.sin(da.deg2rad(lats))
-
-        return da.stack(
-            (x_coords.ravel(), y_coords.ravel(), z_coords.ravel()), axis=-1)
-
     def _create_resample_kdtree(self):
         """Set up kd tree on input"""
         source_lons, source_lats = self.source_geo_def.get_lonlats_dask()
@@ -971,8 +998,7 @@ class XArrayResamplerNN(object):
 
         # FIXME: Is dask smart enough to only compute the pixels we end up
         #        using even with this complicated indexing
-        input_coords = self.transform_lonlats(source_lons,
-                                              source_lats)
+        input_coords = lonlat2xyz(source_lons, source_lats)
         input_coords = input_coords[valid_input_idx.ravel(), :]
 
         # Build kd-tree on input
@@ -988,38 +1014,16 @@ class XArrayResamplerNN(object):
 
     def _query_resample_kdtree(self,
                                resample_kdtree,
-                               target_lons,
-                               target_lats,
-                               valid_output_index,
+                               tlons,
+                               tlats,
+                               valid_oi,
                                reduce_data=True):
         """Query kd-tree on slice of target coordinates."""
-        def query_no_distance(target_lons, target_lats, valid_output_index):
-            voi = valid_output_index
-            shape = voi.shape
-            voir = voi.ravel()
-            target_lons_valid = target_lons.ravel()[voir]
-            target_lats_valid = target_lats.ravel()[voir]
-
-            coords = self.transform_lonlats(target_lons_valid,
-                                            target_lats_valid)
-            distance_array, index_array = resample_kdtree.query(
-                coords.compute(),
-                k=self.neighbours,
-                eps=self.epsilon,
-                distance_upper_bound=self.radius_of_influence)
-
-            # KDTree query returns out-of-bounds neighbors as `len(arr)`
-            # which is an invalid index, we mask those out so -1 represents
-            # invalid values
-            # voi is 2D, index_array is 1D
-            good_pixels = index_array < resample_kdtree.n
-            voi[voi] = good_pixels
-            res_ia = np.full(shape, fill_value=-1, dtype=np.int)
-            res_ia[voi] = index_array[good_pixels]
-            return res_ia
-
-        res = da.map_blocks(query_no_distance, target_lons, target_lats,
-                            valid_output_index, dtype=np.int)
+
+        res = da.map_blocks(query_no_distance, tlons, tlats,
+                            valid_oi, dtype=np.int, kdtree=resample_kdtree,
+                            neighbours=self.neighbours, epsilon=self.epsilon,
+                            radius=self.radius_of_influence)
         return res, None
 
     def get_neighbour_info(self):
@@ -1038,12 +1042,15 @@ class XArrayResamplerNN(object):
 
         # Create kd-tree
         valid_input_idx, resample_kdtree = self._create_resample_kdtree()
+        # This is a numpy array
+        self.valid_input_index = valid_input_idx
+
         if resample_kdtree.n == 0:
             # Handle if all input data is reduced away
             valid_output_idx, index_arr, distance_arr = \
                 _create_empty_info(self.source_geo_def,
                                    self.target_geo_def, self.neighbours)
-            self.valid_input_index = valid_input_idx
+
             self.valid_output_index = valid_output_idx
             self.index_array = index_arr
             self.distance_array = distance_arr
@@ -1056,9 +1063,7 @@ class XArrayResamplerNN(object):
         index_arr, distance_arr = self._query_resample_kdtree(
             resample_kdtree, target_lons, target_lats, valid_output_idx)
 
-        self.valid_output_index, self.index_array = \
-            da.compute(valid_output_idx, index_arr)
-        self.valid_input_index = valid_input_idx
+        self.valid_output_index, self.index_array = valid_output_idx, index_arr
         self.distance_array = distance_arr
 
         return (self.valid_input_index,


=====================================
pyresample/test/test_geometry.py
=====================================
--- a/pyresample/test/test_geometry.py
+++ b/pyresample/test/test_geometry.py
@@ -52,20 +52,6 @@ class Test(unittest.TestCase):
                                                1029087.28,
                                                1490031.3600000001])
         lons, lats = area_def.get_lonlats()
-        area_def2 = geometry.AreaDefinition('areaD', 'Europe (3km, HRV, VTC)', 'areaD',
-                                            {'a': '6378144.0',
-                                             'b': '6356759.0',
-                                             'lat_0': '50.00',
-                                             'lat_ts': '50.00',
-                                             'lon_0': '8.00',
-                                             'proj': 'stere'},
-                                            800,
-                                            800,
-                                            [-1370912.72,
-                                                -909968.64000000001,
-                                                1029087.28,
-                                                1490031.3600000001],
-                                            lons=lons, lats=lats)
         lon, lat = area_def.get_lonlat(400, 400)
         self.assertAlmostEqual(lon, 5.5028467120975835,
                                msg='lon retrieval from precomputated grid failed')
@@ -111,7 +97,7 @@ class Test(unittest.TestCase):
 
         # Test dtype is preserved with automatic longitude wrapping
         lons2 = np.where(lons1 < 0, lons1 + 360, lons1)
-        with catch_warnings() as w:
+        with catch_warnings():
             basedef = geometry.BaseDefinition(lons2, lats)
 
         lons, _ = basedef.get_lonlats()
@@ -120,7 +106,7 @@ class Test(unittest.TestCase):
                          (lons2.dtype, lons.dtype,))
 
         lons2_ints = lons2.astype('int')
-        with catch_warnings() as w:
+        with catch_warnings():
             basedef = geometry.BaseDefinition(lons2_ints, lats)
 
         lons, _ = basedef.get_lonlats()
@@ -181,23 +167,23 @@ class Test(unittest.TestCase):
         arr = np.array([1.2, 1.3, 1.4, 1.5])
         if sys.byteorder == 'little':
             # arr.view(np.uint8)
-            reference = np.array([ 51,  51,  51,  51,  51,  51, 243,
-                                   63, 205, 204, 204, 204, 204,
-                                   204, 244,  63, 102, 102, 102, 102,
-                                   102, 102, 246,  63,   0,   0,
-                                   0,   0,   0,   0, 248,  63],
-                                   dtype=np.uint8)
+            reference = np.array([51,  51,  51,  51,  51,  51, 243,
+                                  63, 205, 204, 204, 204, 204,
+                                  204, 244,  63, 102, 102, 102, 102,
+                                  102, 102, 246,  63,   0,   0,
+                                  0,   0,   0,   0, 248,  63],
+                                 dtype=np.uint8)
         else:
             # on le machines use arr.byteswap().view(np.uint8)
-            reference = np.array([ 63, 243,  51,  51,  51,  51,  51,
-                                   51,  63, 244, 204, 204, 204,
-                                   204, 204, 205,  63, 246, 102, 102,
-                                   102, 102, 102, 102,  63, 248,
-                                   0,   0,   0,   0,   0,   0],
-                                   dtype=np.uint8)
+            reference = np.array([63, 243,  51,  51,  51,  51,  51,
+                                  51,  63, 244, 204, 204, 204,
+                                  204, 204, 205,  63, 246, 102, 102,
+                                  102, 102, 102, 102,  63, 248,
+                                  0,   0,   0,   0,   0,   0],
+                                 dtype=np.uint8)
 
         np.testing.assert_allclose(reference,
-                                    geometry.get_array_hashable(arr))
+                                   geometry.get_array_hashable(arr))
 
         try:
             import xarray as xr
@@ -212,7 +198,6 @@ class Test(unittest.TestCase):
             self.assertEqual(geometry.get_array_hashable(xrarr),
                              xrarr.attrs['hash'])
 
-
     def test_swath_hash(self):
         lons = np.array([1.2, 1.3, 1.4, 1.5])
         lats = np.array([65.9, 65.86, 65.82, 65.78])
@@ -254,14 +239,12 @@ class Test(unittest.TestCase):
 
             self.assertIsInstance(hash(swath_def), int)
 
-
         lons = np.ma.array([1.2, 1.3, 1.4, 1.5])
         lats = np.ma.array([65.9, 65.86, 65.82, 65.78])
         swath_def = geometry.SwathDefinition(lons, lats)
 
         self.assertIsInstance(hash(swath_def), int)
 
-
     def test_area_equal(self):
         area_def = geometry.AreaDefinition('areaD', 'Europe (3km, HRV, VTC)', 'areaD',
                                            {'a': '6378144.0',
@@ -784,8 +767,61 @@ class TestSwathDefinition(unittest.TestCase):
         lats = np.array([65.9, 65.86, 65.82, 65.78])
         swath_def = geometry.SwathDefinition(lons, lats)
         swath_def2 = geometry.SwathDefinition(lons, lats)
+        # Identical lons and lats
         self.assertFalse(
             swath_def != swath_def2, 'swath_defs are not equal as expected')
+        # Identical objects
+        self.assertFalse(
+            swath_def != swath_def, 'swath_defs are not equal as expected')
+
+        lons = np.array([1.2, 1.3, 1.4, 1.5])
+        lats = np.array([65.9, 65.86, 65.82, 65.78])
+        lons2 = np.array([1.2, 1.3, 1.4, 1.5])
+        lats2 = np.array([65.9, 65.86, 65.82, 65.78])
+        swath_def = geometry.SwathDefinition(lons, lats)
+        swath_def2 = geometry.SwathDefinition(lons2, lats2)
+        # different arrays, same values
+        self.assertFalse(
+            swath_def != swath_def2, 'swath_defs are not equal as expected')
+
+        lons = np.array([1.2, 1.3, 1.4, np.nan])
+        lats = np.array([65.9, 65.86, 65.82, np.nan])
+        lons2 = np.array([1.2, 1.3, 1.4, np.nan])
+        lats2 = np.array([65.9, 65.86, 65.82, np.nan])
+        swath_def = geometry.SwathDefinition(lons, lats)
+        swath_def2 = geometry.SwathDefinition(lons2, lats2)
+        # different arrays, same values, with nans
+        self.assertFalse(
+            swath_def != swath_def2, 'swath_defs are not equal as expected')
+
+        try:
+            import dask.array as da
+            lons = da.from_array(np.array([1.2, 1.3, 1.4, np.nan]), chunks=2)
+            lats = da.from_array(np.array([65.9, 65.86, 65.82, np.nan]), chunks=2)
+            lons2 = da.from_array(np.array([1.2, 1.3, 1.4, np.nan]), chunks=2)
+            lats2 = da.from_array(np.array([65.9, 65.86, 65.82, np.nan]), chunks=2)
+            swath_def = geometry.SwathDefinition(lons, lats)
+            swath_def2 = geometry.SwathDefinition(lons2, lats2)
+            # different arrays, same values, with nans
+            self.assertFalse(
+                swath_def != swath_def2, 'swath_defs are not equal as expected')
+        except ImportError:
+            pass
+
+        try:
+            import xarray as xr
+            lons = xr.DataArray(np.array([1.2, 1.3, 1.4, np.nan]))
+            lats = xr.DataArray(np.array([65.9, 65.86, 65.82, np.nan]))
+            lons2 = xr.DataArray(np.array([1.2, 1.3, 1.4, np.nan]))
+            lats2 = xr.DataArray(np.array([65.9, 65.86, 65.82, np.nan]))
+            swath_def = geometry.SwathDefinition(lons, lats)
+            swath_def2 = geometry.SwathDefinition(lons2, lats2)
+            # different arrays, same values, with nans
+            self.assertFalse(
+                swath_def != swath_def2, 'swath_defs are not equal as expected')
+
+        except ImportError:
+            pass
 
     def test_swath_not_equal(self):
         """Test swath inequality."""
@@ -1027,7 +1063,7 @@ class TestStackedAreaDefinition(unittest.TestCase):
         area2.y_size = random.randrange(6425)
         area2.x_size = x_size
 
-        res = concatenate_area_defs(area1, area2)
+        concatenate_area_defs(area1, area2)
         area_extent = [1, 2, 3, 6]
         y_size = area1.y_size + area2.y_size
         adef.assert_called_once_with(area1.area_id, area1.name, area1.proj_id,


=====================================
pyresample/version.py
=====================================
--- a/pyresample/version.py
+++ b/pyresample/version.py
@@ -15,4 +15,4 @@
 # You should have received a copy of the GNU Lesser General Public License along
 # with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-__version__ = '1.8.2'
+__version__ = '1.8.3'


=====================================
setup.py
=====================================
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@
 # This program is free software: you can redistribute it and/or modify it under
 # the terms of the GNU Lesser General Public License as published by the Free
 # Software Foundation, either version 3 of the License, or
-#(at your option) any later version.
+# (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -17,7 +17,7 @@
 
 import imp
 # workaround python bug: http://bugs.python.org/issue15881#msg170215
-import multiprocessing
+import multiprocessing  # noqa: F401
 import os
 import sys
 
@@ -26,7 +26,7 @@ from setuptools.command.build_ext import build_ext as _build_ext
 
 version = imp.load_source('pyresample.version', 'pyresample/version.py')
 
-requirements = ['setuptools>=3.2', 'pyproj>=1.9.5.1', 'numpy', 'configobj',
+requirements = ['setuptools>=3.2', 'pyproj>=1.9.5.1', 'numpy>=1.10.0', 'configobj',
                 'pykdtree>=1.1.1', 'pyyaml', 'six']
 extras_require = {'pykdtree': ['pykdtree>=1.1.1'],
                   'numexpr': ['numexpr'],
@@ -48,7 +48,9 @@ else:
 extensions = [
     Extension("pyresample.ewa._ll2cr", sources=["pyresample/ewa/_ll2cr.pyx"],
               extra_compile_args=extra_compile_args),
-    Extension("pyresample.ewa._fornav", sources=["pyresample/ewa/_fornav.pyx", "pyresample/ewa/_fornav_templates.cpp"], language="c++", extra_compile_args=extra_compile_args,
+    Extension("pyresample.ewa._fornav", sources=["pyresample/ewa/_fornav.pyx",
+                                                 "pyresample/ewa/_fornav_templates.cpp"],
+              language="c++", extra_compile_args=extra_compile_args,
               depends=["pyresample/ewa/_fornav_templates.h"])
 ]
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/compare/675c6fcbbaff6716155453ed76a3159afa0ce391...bb6f4b2c1ee53f3e650dd8aecb9a7ebff35dcbfb

---
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyresample/compare/675c6fcbbaff6716155453ed76a3159afa0ce391...bb6f4b2c1ee53f3e650dd8aecb9a7ebff35dcbfb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-grass-devel/attachments/20180323/0b12f66d/attachment-0001.html>


More information about the Pkg-grass-devel mailing list