[Git][debian-gis-team/pyspectral][master] 5 commits: New upstream version 0.13.4+ds

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sat Aug 17 07:54:38 BST 2024



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


Commits:
a6940667 by Antonio Valentino at 2024-08-17T06:16:19+00:00
New upstream version 0.13.4+ds
- - - - -
e3596fcc by Antonio Valentino at 2024-08-17T06:16:23+00:00
Update upstream source from tag 'upstream/0.13.4+ds'

Update to upstream version '0.13.4+ds'
with Debian dir 75891c72a7bf552ab3c2cde311885e6d664820fe
- - - - -
8877e01b by Antonio Valentino at 2024-08-17T06:16:55+00:00
New upstream release

- - - - -
7c99a02c by Antonio Valentino at 2024-08-17T06:23:38+00:00
Refresh all patches

- - - - -
ef80e280 by Antonio Valentino at 2024-08-17T06:51:09+00:00
Set diatribution to unstable

- - - - -


13 changed files:

- CHANGELOG.md
- debian/changelog
- debian/patches/0001-Fix-tests.patch
- debian/patches/0002-Fix-install-data.patch
- − doc/rtd_requirements.txt
- pyspectral/radiance_tb_conversion.py
- pyspectral/rsr_reader.py
- pyspectral/solar.py
- pyspectral/tests/__init__.py
- pyspectral/utils.py
- − requirements.txt
- rsr_convert_scripts/seviri_rsr.py
- setup.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,21 @@
+## Version v0.13.4 (2024/08/14)
+
+### Issues Closed
+
+* [Issue 229](https://github.com/pytroll/pyspectral/issues/229) - Deprecate old scipy and remove use of trapz (numpy and scipy) ([PR 233](https://github.com/pytroll/pyspectral/pull/233) by [@djhoese](https://github.com/djhoese))
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 233](https://github.com/pytroll/pyspectral/pull/233) - Replace deprecated numpy trapezoid/trapz usage with scipy trapezoid ([229](https://github.com/pytroll/pyspectral/issues/229))
+* [PR 232](https://github.com/pytroll/pyspectral/pull/232) - Cleanup unused dependencies and deprecated code
+
+In this release 2 pull requests were closed.
+
+
 ## Version v0.13.3 (2024/07/17)
 
 ### Pull Requests Merged


=====================================
debian/changelog
=====================================
@@ -1,13 +1,18 @@
-pyspectral (0.13.3+ds-2) UNRELEASED; urgency=medium
+pyspectral (0.13.4+ds-1) unstable; urgency=medium
 
-  * Team upload.
+  [ Bas Couwenberg ]
   * Bump Standards-Version to 4.7.0, no changes.
 
- -- Bas Couwenberg <sebastic at debian.org>  Sun, 28 Jul 2024 19:56:10 +0200
+  [ Antonio Valentino ]
+  * New upstream release.
+  * debian/patches:
+    - Refresh all patches.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it>  Sat, 17 Aug 2024 06:23:48 +0000
 
 pyspectral (0.13.3+ds-1) unstable; urgency=medium
 
-  * New upstream release. 
+  * New upstream release.
 
  -- Antonio Valentino <antonio.valentino at tiscali.it>  Sat, 20 Jul 2024 10:09:22 +0000
 


=====================================
debian/patches/0001-Fix-tests.patch
=====================================
@@ -6,24 +6,15 @@ Disable tests that require the network or external data
 
 Forwarded: not-needed
 ---
- pyspectral/tests/__init__.py | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
+ pyspectral/tests/__init__.py | 1 +
+ 1 file changed, 1 insertion(+)
 
 diff --git a/pyspectral/tests/__init__.py b/pyspectral/tests/__init__.py
-index 4688c7d..8b6435d 100644
+index b6039d7..bfac2b8 100644
 --- a/pyspectral/tests/__init__.py
 +++ b/pyspectral/tests/__init__.py
-@@ -39,10 +39,10 @@ def suite():
-     mysuite = unittest.TestSuite()
-     if not TRAVIS and not APPVEYOR:
-         # Test sphinx documentation pages:
--        mysuite.addTests(doctest.DocFileSuite('../../doc/usage.rst'))
--        mysuite.addTests(doctest.DocFileSuite('../../doc/rad_definitions.rst'))
-+        # mysuite.addTests(doctest.DocFileSuite('../../doc/usage.rst'))
-+        # mysuite.addTests(doctest.DocFileSuite('../../doc/rad_definitions.rst'))
-         # mysuite.addTests(doctest.DocFileSuite('../../doc/seviri_example.rst'))
--        mysuite.addTests(doctest.DocFileSuite('../../doc/37_reflectance.rst'))
-+        # mysuite.addTests(doctest.DocFileSuite('../../doc/37_reflectance.rst'))
-         # Test the documentation strings
-         mysuite.addTests(doctest.DocTestSuite(solar))
-         mysuite.addTests(doctest.DocTestSuite(near_infrared_reflectance))
+@@ -17,3 +17,4 @@
+ # You should have received a copy of the GNU General Public License
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ """The tests package."""
++


=====================================
debian/patches/0002-Fix-install-data.patch
=====================================
@@ -8,10 +8,10 @@ Forwarded: not-needed
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/setup.py b/setup.py
-index 7b5f009..89616bf 100644
+index b851fa2..a48269c 100644
 --- a/setup.py
 +++ b/setup.py
-@@ -78,8 +78,8 @@ setup(name=NAME,
+@@ -76,8 +76,8 @@ setup(name=NAME,
        scripts=['bin/plot_rsr.py', 'bin/composite_rsr_plot.py',
                 'bin/download_atm_correction_luts.py',
                 'bin/download_rsr.py'],
@@ -19,6 +19,6 @@ index 7b5f009..89616bf 100644
 -                             'pyspectral/data/MSG_SEVIRI_Spectral_Response_Characterisation.XLS'])],
 +      # data_files=[('share/', ['pyspectral/data/e490_00a.dat',
 +      #                        'pyspectral/data/MSG_SEVIRI_Spectral_Response_Characterisation.XLS'])],
-       test_suite='pyspectral.tests.suite',
-       tests_require=test_requires,
        python_requires='>=3.10',
+       zip_safe=False,
+       )


=====================================
doc/rtd_requirements.txt deleted
=====================================
@@ -1,10 +0,0 @@
-python-geotiepoints>=1.1.1
-numpy>=1.22.2
-scipy>=0.14
-h5py>=2.5
-six
-requests
-tqdm
-pyyaml
-xlrd
-git-lfs


=====================================
pyspectral/radiance_tb_conversion.py
=====================================
@@ -28,16 +28,12 @@ import logging
 from numbers import Number
 
 import numpy as np
+from scipy.integrate import trapezoid
 
 from pyspectral.blackbody import C_SPEED, H_PLANCK, K_BOLTZMANN, blackbody, blackbody_wn
 from pyspectral.rsr_reader import RelativeSpectralResponse
 from pyspectral.utils import BANDNAMES, WAVE_LENGTH, WAVE_NUMBER, convert2wavenumber, get_bandname_from_wavelength
 
-try:
-    from scipy.integrate import trapezoid
-except ImportError:
-    from scipy.integrate import trapz as trapezoid
-
 LOG = logging.getLogger(__name__)
 
 BLACKBODY_FUNC = {WAVE_LENGTH: blackbody,
@@ -159,7 +155,7 @@ class RadTbConverter(object):
                                          self._wave_si_scale)
         self.response = self.rsr[self.bandname][self.detector]['response']
         # Get the integral of the spectral response curve:
-        self.rsr_integral = np.trapz(self.response, self.wavelength_or_wavenumber)
+        self.rsr_integral = trapezoid(self.response, self.wavelength_or_wavenumber)
 
     def _getsatname(self):
         """Get the satellite name used in the rsr-reader, from the platform and number."""


=====================================
pyspectral/rsr_reader.py
=====================================
@@ -24,7 +24,7 @@ import os
 from glob import glob
 from os.path import expanduser
 
-import numpy as np
+from scipy.integrate import trapezoid
 
 from pyspectral.bandnames import BANDNAMES
 from pyspectral.config import get_config
@@ -214,7 +214,7 @@ class RelativeSpectralResponse(RSRDataBaseClass):
         for det in self.rsr[bandname].keys():
             wvl = self.rsr[bandname][det]['wavelength']
             resp = self.rsr[bandname][det]['response']
-            intg[det] = np.trapz(resp, wvl)
+            intg[det] = trapezoid(resp, wvl)
         return intg
 
     def convert(self):


=====================================
pyspectral/solar.py
=====================================
@@ -29,6 +29,7 @@ import logging
 from pathlib import Path
 
 import numpy as np
+from scipy.integrate import trapezoid
 
 LOG = logging.getLogger(__name__)
 
@@ -121,9 +122,9 @@ class SolarIrradianceSpectrum(object):
     def solar_constant(self):
         """Calculate the solar constant."""
         if self.wavenumber is not None:
-            return np.trapz(self.irradiance, self.wavenumber)
+            return trapezoid(self.irradiance, self.wavenumber)
         if self.wavelength is not None:
-            return np.trapz(self.irradiance, self.wavelength)
+            return trapezoid(self.irradiance, self.wavelength)
 
         raise TypeError('Neither wavelengths nor wavenumbers available!')
 
@@ -204,10 +205,10 @@ class SolarIrradianceSpectrum(object):
 
         # Calculate the solar-flux: (w/m2)
         if flux:
-            return np.trapz(irr * resp_ipol, wvl)
+            return trapezoid(irr * resp_ipol, wvl)
 
         # Divide by the equivalent band width:
-        return np.trapz(irr * resp_ipol, wvl) / np.trapz(resp_ipol, wvl)
+        return trapezoid(irr * resp_ipol, wvl) / trapezoid(resp_ipol, wvl)
 
     def interpolate(self, **options):
         """Interpolate Irradiance to a specified evenly spaced resolution/grid.


=====================================
pyspectral/tests/__init__.py
=====================================
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-
+#
 # Copyright (c) 2013-2022 Pytroll Developers
 #
 #
@@ -8,48 +8,12 @@
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation, either version 3 of the License, or
 # (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 FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
 """The tests package."""
-
-import doctest
-import os
-import sys
-
-from pyspectral import blackbody, near_infrared_reflectance, solar
-
-if sys.version_info < (2, 7):
-    import unittest2 as unittest
-else:
-    import unittest
-
-TRAVIS = os.environ.get("TRAVIS", False)
-APPVEYOR = os.environ.get("APPVEYOR", False)
-
-
-def suite():
-    """Perform the unit testing."""
-    mysuite = unittest.TestSuite()
-    if not TRAVIS and not APPVEYOR:
-        # Test sphinx documentation pages:
-        mysuite.addTests(doctest.DocFileSuite('../../doc/usage.rst'))
-        mysuite.addTests(doctest.DocFileSuite('../../doc/rad_definitions.rst'))
-        # mysuite.addTests(doctest.DocFileSuite('../../doc/seviri_example.rst'))
-        mysuite.addTests(doctest.DocFileSuite('../../doc/37_reflectance.rst'))
-        # Test the documentation strings
-        mysuite.addTests(doctest.DocTestSuite(solar))
-        mysuite.addTests(doctest.DocTestSuite(near_infrared_reflectance))
-        mysuite.addTests(doctest.DocTestSuite(blackbody))
-
-    return mysuite
-
-
-if __name__ == '__main__':
-    unittest.TextTestRunner(verbosity=2).run(suite())


=====================================
pyspectral/utils.py
=====================================
@@ -21,6 +21,7 @@
 
 import logging
 import os
+import sys
 import tarfile
 import warnings
 from functools import wraps
@@ -28,6 +29,7 @@ from inspect import getfullargspec
 
 import numpy as np
 import requests
+from scipy.integrate import trapezoid
 
 from pyspectral.bandnames import BANDNAMES
 from pyspectral.config import get_config
@@ -224,7 +226,7 @@ def get_central_wave(wav, resp, weight=1.0):
     # if info['unit'].find('-1') > 0:
     # Wavenumber:
     #     res *=
-    return np.trapz(resp * wav * weight, wav) / np.trapz(resp * weight, wav)
+    return trapezoid(resp * wav * weight, wav) / trapezoid(resp * weight, wav)
 
 
 def get_bandname_from_wavelength(sensor, wavelength, rsr, epsilon=0.1, multiple_bands=False):
@@ -413,7 +415,8 @@ def _download_tarball_and_extract(tarball_url, local_pathname, extract_dir):
             handle.write(data)
 
     tar = tarfile.open(local_pathname)
-    tar.extractall(extract_dir)
+    tar_kwargs = {} if sys.version_info < (3, 12) else {"filter": "data"}
+    tar.extractall(extract_dir, **tar_kwargs)
     tar.close()
     os.remove(local_pathname)
 


=====================================
requirements.txt deleted
=====================================
@@ -1,5 +0,0 @@
-python-geotiepoints>=1.1.1
-numpy>=1.5.1
-scipy>=0.14
-h5py>=2.5
-six


=====================================
rsr_convert_scripts/seviri_rsr.py
=====================================
@@ -25,6 +25,7 @@ import os
 
 import numpy as np
 import pkg_resources
+from scipy.integrate import trapezoid
 from xlrd import open_workbook
 
 from pyspectral.config import get_config
@@ -210,7 +211,7 @@ class Seviri(object):
 
 def get_central_wave(wavl, resp):
     """Calculate the central wavelength (or the central wavenumber if inputs are wave numbers)."""
-    return np.trapz(resp * wavl, wavl) / np.trapz(resp, wavl)
+    return trapezoid(resp * wavl, wavl) / trapezoid(resp, wavl)
 
 
 def generate_seviri_file(seviri, platform_name):


=====================================
setup.py
=====================================
@@ -26,13 +26,10 @@ from setuptools import find_packages, setup
 description = ('Reading and manipulaing satellite sensor spectral responses and the '
                'solar spectrum, to perfom various corrections to VIS and NIR band data')
 
-try:
-    with open('./README.md', 'r') as fd:
-        long_description = fd.read()
-except IOError:
-    long_description = ''
+with open('./README.md', 'r') as fd:
+    long_description = fd.read()
 
-requires = ['docutils>=0.3', 'numpy', 'scipy', 'python-geotiepoints>=1.1.1',
+requires = ['numpy', 'scipy>=1.6.0', 'python-geotiepoints>=1.1.1',
             'h5py>=2.5', 'requests', 'pyyaml', 'platformdirs']
 
 dask_extra = ['dask[array]']
@@ -74,14 +71,13 @@ setup(name=NAME,
                       'matplotlib': ['matplotlib'],
                       'pandas': ['pandas'],
                       'tqdm': ['tqdm'],
+                      'test': test_requires,
                       'dask': dask_extra},
       scripts=['bin/plot_rsr.py', 'bin/composite_rsr_plot.py',
                'bin/download_atm_correction_luts.py',
                'bin/download_rsr.py'],
       data_files=[('share', ['pyspectral/data/e490_00a.dat',
                              'pyspectral/data/MSG_SEVIRI_Spectral_Response_Characterisation.XLS'])],
-      test_suite='pyspectral.tests.suite',
-      tests_require=test_requires,
       python_requires='>=3.10',
       zip_safe=False,
       )



View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/compare/33d0b1aa09abe58fa534bced7ebb2550360a614c...ef80e280478a1804b66541323d9355685c2be76c

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/compare/33d0b1aa09abe58fa534bced7ebb2550360a614c...ef80e280478a1804b66541323d9355685c2be76c
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/20240817/85c87470/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list