[pyresample] 01/06: New upstream version 1.2.6

Antonio Valentino a_valentino-guest at moszumanska.debian.org
Sun Oct 30 02:02:15 UTC 2016


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 dceb6d4bccc188225f48e8a96c283a2d36e97fe5
Author: Antonio Valentino <antonio.valentino at tiscali.it>
Date:   Sat Oct 29 07:22:22 2016 +0000

    New upstream version 1.2.6
---
 README.md                       |  2 +
 appveyor.yml                    | 15 ++++++-
 appveyor/missing-headers.ps1    | 53 +++++++++++++++++++++++++
 changelog.rst                   | 45 +++++++++++++++++++++
 pyresample/geometry.py          | 87 +++++++++++++++++++++++++++++++++++++++++
 pyresample/test/test_kd_tree.py | 16 ++++----
 pyresample/version.py           |  2 +-
 7 files changed, 209 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index bf849cf..d1e5fed 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,6 @@
 [![Build Status](https://travis-ci.org/pytroll/pyresample.svg?branch=master)](https://travis-ci.org/pytroll/pyresample)
+[![Build status](https://ci.appveyor.com/api/projects/status/10qdrecp45rgkf73/branch/master?svg=true)](https://ci.appveyor.com/project/davidh-ssec/pyresample-ly2q0/branch/master)
+
 
 Python package for geospatial resampling
 ----------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 901e81a..3216a64 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,6 +4,8 @@ environment:
     # /E:ON and /V:ON options are not enabled in the batch script intepreter
     # See: http://stackoverflow.com/a/13751649/163740
     CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
+  # Don't build pykdtree with openmp because it isn't supported in appveyor's compilers
+    USE_OMP: "0"
 
   matrix:
     - PYTHON: "C:\\Python27_32"
@@ -46,6 +48,10 @@ install:
 
   # install miniconda with the powershell script install.ps1
   - "powershell ./appveyor/install.ps1"
+  # install missing headers that aren't included with MSVC 2008
+  # https://github.com/omnia-md/conda-recipes/pull/524
+  # Needed for pykdtree to compile on appveyor's Windows machines
+  - "powershell ./appveyor/missing-headers.ps1"
 
   # Prepend newly installed Python to the PATH of this build (this cannot be
   # done from inside the powershell script as it would require to restart
@@ -61,8 +67,8 @@ install:
   # pip will build them from source using the MSVC compiler matching the
   # target Python version and architecture
   - "conda update --yes conda"
-  - "conda config --add channels https://conda.anaconda.org/ioos"
-  - "conda create -q --yes -n test python=%PYTHON_VERSION% basemap sphinx pyproj scipy"
+  - "conda config --add channels conda-forge"
+  - "conda create -q --yes -n test python=%PYTHON_VERSION% basemap-data-hires sphinx pyproj scipy"
   - "activate test"
   - "pip install coveralls"
   # Try to install pykdtree, but continue on if we can't
@@ -87,3 +93,8 @@ artifacts:
 #on_success:
 #  - TODO: upload the content of dist/*.whl to a public wheelhouse
 #
+
+notifications:
+  - provider: Slack
+    incoming_webhook:
+      secure: 7bEOYCIxHE5PkCF156zjxbJIeKkv7UpZulyn+Di09jqDlpvZjR0Qj3a1LK9AOjgwWgaQYbeI4BEYEdeq7pPxDs9snK8qvvbFDbuLAzg+HEQ=
diff --git a/appveyor/missing-headers.ps1 b/appveyor/missing-headers.ps1
new file mode 100644
index 0000000..44e1b90
--- /dev/null
+++ b/appveyor/missing-headers.ps1
@@ -0,0 +1,53 @@
+function InstallMissingHeaders () {
+    # Visual Studio 2008 is missing stdint.h, but you can just download one
+    # from the web.
+    # http://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio
+    $webclient = New-Object System.Net.WebClient
+
+    $include_dirs = @("C:\Program Files\Microsoft SDKs\Windows\v7.0\Include",
+                      "C:\Program Files\Microsoft SDKs\Windows\v7.1\Include",
+                      "C:\Users\appveyor\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\include",
+                      "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include",
+                      "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include")
+
+    Foreach ($include_dir in $include_dirs) {
+    $urls = @(@("https://raw.githubusercontent.com/chemeris/msinttypes/master/stdint.h", "stdint.h"),
+             @("https://raw.githubusercontent.com/chemeris/msinttypes/master/inttypes.h", "inttypes.h"))
+
+    Foreach ($i in $urls) {
+        $url = $i[0]
+        $filename = $i[1]
+
+        $filepath = "$include_dir\$filename"
+        if (Test-Path $filepath) {
+            Write-Host $filename "already exists in" $include_dir
+            continue
+        }
+
+        Write-Host "Downloading remedial " $filename " from" $url "to" $filepath
+        $retry_attempts = 2
+        for($i=0; $i -lt $retry_attempts; $i++){
+            try {
+                $webclient.DownloadFile($url, $filepath)
+                break
+            }
+            Catch [Exception]{
+                Start-Sleep 1
+            }
+       }
+
+       if (Test-Path $filepath) {
+           Write-Host "File saved at" $filepath
+       } else {
+           # Retry once to get the error message if any at the last try
+           $webclient.DownloadFile($url, $filepath)
+       }
+    }
+    }
+}
+
+function main() {
+    InstallMissingHeaders
+}
+
+main
diff --git a/changelog.rst b/changelog.rst
index ac9516d..8dc4a9e 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -6,6 +6,51 @@ Changelog
 
 - Update changelog. [Martin Raspaud]
 
+- Bump version: 1.2.5 → 1.2.6. [Martin Raspaud]
+
+- Pre master (#44) [Radar, Satellite and Nowcasting Division]
+
+  * add a subset function to the geometry file
+
+  Often subsets of the SEVIRI disk are save in
+  SEVIRI products. This new function calculated the
+  area extent needed for the specification of the area,
+  starting from the SEVIRI full disk area object.
+
+  * added the get_area_extent_for_subset function
+
+  to the geometry.py file
+
+  * new function for getting area subsets
+
+  * new function get_xy_from_proj_coordinates
+
+  retrieve the pixel indices x and y
+  from the map projection coordinates in meter
+  (very similar to get_xy_from_lonlat)
+
+  * removed pyc file, that should not be in the git repository
+
+
+- Add appveyor status badge to README. [davidh-ssec]
+
+- Merge remote-tracking branch 'deni90/master' into pre-master-davidh.
+  [davidh-ssec]
+
+- Fix test_custom_uncert and test_gauss_uncert for mips* [Daniel
+  Knezevic]
+
+- Fix pykdtree install on appveyor by turning off OpenMP. [davidh-ssec]
+
+- Update appveyor config to install missing headers required by
+  pykdtree. [davidh-ssec]
+
+- Change appveyor to use conda-forge instead of IOOS. [davidh-ssec]
+
+- Add slack notifications from appveyor. [davidh-ssec]
+
+- Update changelog. [Martin Raspaud]
+
 - Bump version: 1.2.4 → 1.2.5. [Martin Raspaud]
 
 - Fix EWA fornav for integer data and add test. [davidh-ssec]
diff --git a/pyresample/geometry.py b/pyresample/geometry.py
index 4c9711c..3fda9f3 100644
--- a/pyresample/geometry.py
+++ b/pyresample/geometry.py
@@ -106,6 +106,37 @@ class BaseDefinition(object):
 
         return not self.__eq__(other)
 
+    def get_area_extent_for_subset(self, row_LR, col_LR, row_UL, col_UL):
+        """Retrieves area_extent for a subdomain 
+        rows    are counted from upper left to lower left
+        columns are counted from upper left to upper right 
+
+        :Parameters:
+        row_LR : int
+            row of the lower right pixel 
+        col_LR : int
+            col of the lower right pixel
+        row_UL : int
+            row of the upper left pixel 
+        col_UL : int
+            col of the upper left pixel
+
+        :Returns:
+        area_extent : list 
+            Area extent as a list (LL_x, LL_y, UR_x, UR_y) of the subset
+
+        :Author:
+        Ulrich Hamann
+        """
+        
+        (a,b) = self.get_proj_coords( data_slice=(row_LR,col_LR) )
+        a = a - 0.5*self.pixel_size_x
+        b = b - 0.5*self.pixel_size_y
+        (c,d) = self.get_proj_coords( data_slice=(row_UL,col_UL) )
+        c = c + 0.5*self.pixel_size_x
+        d = d + 0.5*self.pixel_size_y
+
+        return (a,b,c,d)
 
     def get_lonlat(self, row, col):
         """Retrieve lon and lat of single pixel
@@ -667,6 +698,62 @@ class AreaDefinition(BaseDefinition):
                 raise ValueError('Point outside area:( %f %f)' % (x__, y__))
             return int(x__), int(y__)
 
+
+    def get_xy_from_proj_coords(self, xm_, ym_):
+        """Retrieve closest x and y coordinates (column, row indices) for a 
+        location specified with projection coordinates (xm_,ym_) in meters. 
+        A ValueError is raised, if the return point is outside the area domain. If
+        xm_,ym_ is a tuple of sequences of projection coordinates, a tuple of
+        masked arrays are returned.
+
+        :Input:
+        xm_ : point or sequence (list or array) of x-coordinates in m (map projection)
+        ym_ : point or sequence (list or array) of y-coordinates in m (map projection)
+
+        :Returns:
+        (x, y) : tuple of integer points/arrays
+        """
+
+        if isinstance(xm_, list):
+            xm_ = np.array(xm_)
+        if isinstance(ym_, list):
+            ym_ = np.array(ym_)
+
+        if ((isinstance(xm_, np.ndarray) and
+             not isinstance(ym_, np.ndarray)) or
+            (not isinstance(xm_, np.ndarray) and
+             isinstance(ym_, np.ndarray))):
+            raise ValueError("Both projection coordinates xm_ and ym_ needs to be of " +
+                             "the same type and have the same dimensions!")
+
+        if isinstance(xm_, np.ndarray) and isinstance(ym_, np.ndarray):
+            if xm_.shape != ym_.shape:
+                raise ValueError("projection coordinates xm_ and ym_ is not of the same shape!")
+
+        upl_x = self.area_extent[0]
+        upl_y = self.area_extent[3]
+        xscale = abs(self.area_extent[2] -
+                     self.area_extent[0]) / float(self.x_size)
+        yscale = abs(self.area_extent[1] -
+                     self.area_extent[3]) / float(self.y_size)
+
+        x__ = (xm_ - upl_x) / xscale
+        y__ = (upl_y - ym_) / yscale
+
+        if isinstance(x__, np.ndarray) and isinstance(y__, np.ndarray):
+            mask = (((x__ < 0) | (x__ > self.x_size)) |
+                    ((y__ < 0) | (y__ > self.y_size)))
+            return (np.ma.masked_array(x__.astype('int'), mask=mask,
+                                       fill_value=-1),
+                    np.ma.masked_array(y__.astype('int'), mask=mask,
+                                       fill_value=-1))
+        else:
+            if ((x__ < 0 or x__ > self.x_size) or
+                    (y__ < 0 or y__ > self.y_size)):
+                raise ValueError('Point outside area:( %f %f)' % (x__, y__))
+            return int(x__), int(y__)
+
+
     def get_lonlat(self, row, col):
         """Retrieves lon and lat values of single point in area grid
 
diff --git a/pyresample/test/test_kd_tree.py b/pyresample/test/test_kd_tree.py
index 891d2b4..80dbec0 100644
--- a/pyresample/test/test_kd_tree.py
+++ b/pyresample/test/test_kd_tree.py
@@ -75,10 +75,10 @@ class Test(unittest.TestCase):
             res, stddev, count = kd_tree.resample_gauss(self.tswath, self.tdata,
                                                         self.tgrid, 100000, sigma,
                                                         with_uncert=True)
-            self.assertFalse(
-                len(w) != 1, 'Failed to create neighbour warning')
-            self.assertFalse(('Searching' not in str(
-                w[0].message)), 'Failed to create correct neighbour warning')
+            self.assertTrue(
+                len(w) > 0, 'Failed to create neighbour warning')
+            self.assertTrue((any('Searching' in str(_w.message) for _w in w)),
+                'Failed to create correct neighbour warning')
 
         expected_res = 2.20206560694
         expected_stddev = 0.707115076173
@@ -98,10 +98,10 @@ class Test(unittest.TestCase):
             res, stddev, counts = kd_tree.resample_custom(self.tswath,
                                                           self.tdata, self.tgrid,
                                                           100000, wf, with_uncert=True)
-            self.assertFalse(
-                len(w) != 1, 'Failed to create neighbour warning')
-            self.assertFalse(('Searching' not in str(
-                w[0].message)), 'Failed to create correct neighbour warning')
+            self.assertTrue(
+                len(w) > 0, 'Failed to create neighbour warning')
+            self.assertTrue((any('Searching' in str(_w.message) for _w in w)),
+                'Failed to create correct neighbour warning')
 
         self.assertAlmostEqual(res[0], 2.32193149, 5,
                                'Failed to calculate custom weighting with uncertainty')
diff --git a/pyresample/version.py b/pyresample/version.py
index bcdb12b..9fa86ae 100644
--- 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.2.5'
+__version__ = '1.2.6'

-- 
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