[Git][debian-gis-team/pyspectral][upstream] New upstream version 0.13.4+ds
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Aug 17 07:39:53 BST 2024
Antonio Valentino pushed to branch upstream 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
- - - - -
10 changed files:
- CHANGELOG.md
- − 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
=====================================
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/-/commit/a694066795d7885835cec804e70e51287fdda51f
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/commit/a694066795d7885835cec804e70e51287fdda51f
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/fdbaee76/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list