[Git][debian-gis-team/pyspectral][master] 5 commits: New upstream version 0.14.1+ds
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Feb 7 17:28:46 GMT 2026
Antonio Valentino pushed to branch master at Debian GIS Project / pyspectral
Commits:
b9a525fa by Antonio Valentino at 2026-02-07T17:18:13+00:00
New upstream version 0.14.1+ds
- - - - -
4072d618 by Antonio Valentino at 2026-02-07T17:18:14+00:00
Update upstream source from tag 'upstream/0.14.1+ds'
Update to upstream version '0.14.1+ds'
with Debian dir d407c34c8312e2701b51440bf8a9f0bcad6a941b
- - - - -
39a230aa by Antonio Valentino at 2026-02-07T17:18:47+00:00
New upstream release
- - - - -
b0e0428e by Antonio Valentino at 2026-02-07T17:21:36+00:00
Re-enable test_rayleigh
- - - - -
343f7516 by Antonio Valentino at 2026-02-07T17:27:37+00:00
Set distribution to unstable
- - - - -
7 changed files:
- CHANGELOG.md
- debian/changelog
- debian/rules
- pyspectral/rsr_reader.py
- pyspectral/testing.py
- pyspectral/tests/test_rsr_reader.py
- + pyspectral/tests/test_testing.py
Changes:
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,21 @@
+## Version 0.14.1 (2026/02/06)
+
+### Issues Closed
+
+* [Issue 268](https://github.com/pytroll/pyspectral/issues/268) - Pyspectral documentation has problems with overflowing left-hand bar.
+
+In this release 1 issue was closed.
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 276](https://github.com/pytroll/pyspectral/pull/276) - Fix RSR downloads not downloading on-demand
+* [PR 275](https://github.com/pytroll/pyspectral/pull/275) - Fix testing utilities using strings as Path
+
+In this release 2 pull requests were closed.
+
+
## Version 0.14.0 (2026/01/28)
### Issues Closed
@@ -537,7 +555,7 @@ In this release 9 pull requests were closed.
In this release 2 pull requests were closed.
-## Version <RELEASE_VERSION> (2019/09/30)
+## Version 0.14.1 (2019/09/30)
### Issues Closed
@@ -551,7 +569,7 @@ In this release 2 pull requests were closed.
In this release 2 pull requests were closed.
-## Version <RELEASE_VERSION> (2019/08/30)
+## Version 0.14.1 (2019/08/30)
### Issues Closed
@@ -575,7 +593,7 @@ In this release 1 issue was closed.
In this release 5 pull requests were closed.
-## Version <RELEASE_VERSION> (2019/06/07)
+## Version 0.14.1 (2019/06/07)
### Issues Closed
@@ -591,7 +609,7 @@ In this release 1 issue was closed.
In this release 1 pull request was closed.
-## Version <RELEASE_VERSION> (2019/04/29)
+## Version 0.14.1 (2019/04/29)
### Issues Closed
@@ -615,7 +633,7 @@ In this release 4 issues were closed.
In this release 4 pull requests were closed.
-## Version <RELEASE_VERSION> (2019/04/09)
+## Version 0.14.1 (2019/04/09)
### Issues Closed
@@ -640,7 +658,7 @@ In this release 3 issues were closed.
In this release 2 pull requests were closed.
-## Version <RELEASE_VERSION> (2018/12/04)
+## Version 0.14.1 (2018/12/04)
### Issues Closed
@@ -657,7 +675,7 @@ In this release 1 issue was closed.
In this release 1 pull request was closed.
-## Version <RELEASE_VERSION> (2018/11/30)
+## Version 0.14.1 (2018/11/30)
### Issues Closed
@@ -679,7 +697,7 @@ In this release 1 issue was closed.
In this release 3 pull requests were closed.
-## Version <RELEASE_VERSION> (2018/11/30)
+## Version 0.14.1 (2018/11/30)
### Issues Closed
=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+pyspectral (0.14.1+ds-1) unstable; urgency=medium
+
+ * New upstream release.
+ * debian/rules:
+ - Re-enable test_rayleigh.
+
+ -- Antonio Valentino <antonio.valentino at tiscali.it> Sat, 07 Feb 2026 17:27:16 +0000
+
pyspectral (0.14.0+ds-1) unstable; urgency=medium
[ Bas Couwenberg ]
=====================================
debian/rules
=====================================
@@ -4,7 +4,7 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
-export PYBUILD_TEST_ARGS=-k 'not test_rayleigh' --pyargs pyspectral
+export PYBUILD_TEST_ARGS=--pyargs pyspectral
export PYBUILD_AFTER_TEST=${RM} -r {build_dir}/.pytest_cache
# export PSP_CONFIG_FILE=debian/pyspectral_testcfg.yaml
=====================================
pyspectral/rsr_reader.py
=====================================
@@ -152,14 +152,14 @@ class RelativeSpectralResponse(_RSRDataBase):
"""
super(RelativeSpectralResponse, self).__init__()
- filename, platform_name, instrument = self._sanitize_inputs(
+ resolved_filename, resolved_platform_name, resolved_instrument = self._sanitize_inputs(
filename,
platform_name,
instrument,
)
- self.filename = filename
- self.platform_name = platform_name
- self.instrument = instrument
+ self.filename = resolved_filename
+ self.platform_name = resolved_platform_name
+ self.instrument = resolved_instrument
self.unit = '1e-6 m'
self.si_scale = 1e-6 # How to scale the wavelengths to become SI unit
self._wavespace = WAVE_LENGTH
=====================================
pyspectral/testing.py
=====================================
@@ -111,7 +111,7 @@ def mock_pyspectral_downloads(
tmp_path_manager = None
if tmp_path is None:
tmp_path_manager = tempfile.TemporaryDirectory(prefix="pyspectral_testing_")
- tmp_path = tmp_path_manager.name
+ tmp_path = Path(tmp_path_manager.name)
config_options = {}
config_options["download_from_internet"] = False
@@ -155,7 +155,7 @@ def mock_tb_conversion(
tmp_path_manager = None
if tb2rad_dir is None:
tmp_path_manager = tempfile.TemporaryDirectory(prefix="pyspectral_testing_")
- tb2rad_dir = tmp_path_manager.name
+ tb2rad_dir = Path(tmp_path_manager.name)
if rsr_dir is None:
rsr_dir = tb2rad_dir
@@ -190,7 +190,8 @@ def init_tb_cache(tb2rad_dir: Path) -> Iterator[None]:
def mock_rsr(
*,
rsr_dir: Path | None = None,
- rsr_data_version: str = RSR_DATA_VERSION,
+ rsr_data_version: str | None = RSR_DATA_VERSION,
+ download_from_internet: bool = False,
central_wavelengths: dict[str, float] | None = None,
side_effect: Any = "__unset__",
return_value: Any = "__unset__",
@@ -207,6 +208,11 @@ def mock_rsr(
temporary directory is used and deleted on exit of the context manager.
rsr_data_version: Version number to use for the created fake RSR files.
By default, the newest/active version number will be used.
+ See :func:`mock_rsr_files` for more details.
+ download_from_internet: Set pyspectral configuration value to allow or
+ disallow downloads to occur. Defaults to False and relies on mocking
+ to make the files seem like they exist. If ``True`` then downloads
+ may be attempted if ``rsr_data_version`` is out of date or ``None``.
central_wavelengths: Dictionary mapping a channel name to a central wavelength
floating point number. This is used to generate more realistic data in the
created fake RSR files. This has no effect if ``side_effect`` or
@@ -224,10 +230,10 @@ def mock_rsr(
tmp_path_manager = None
if rsr_dir is None:
tmp_path_manager = tempfile.TemporaryDirectory(prefix="pyspectral_testing_")
- rsr_dir = tmp_path_manager.name
+ rsr_dir = Path(tmp_path_manager.name)
fake_config = {
"rsr_dir": str(rsr_dir),
- "download_from_internet": False,
+ "download_from_internet": download_from_internet,
}
config_cm = override_config(config_options=fake_config)
rsr_files_cm = mock_rsr_files(
@@ -247,7 +253,7 @@ def mock_rsr(
def mock_rsr_files(
rsr_dir: Path,
*,
- rsr_data_version: str = RSR_DATA_VERSION,
+ rsr_data_version: str | None = RSR_DATA_VERSION,
central_wavelengths: dict[str, float] | None = None,
side_effect: Any = "__unset__",
return_value: Any = "__unset__",
@@ -264,6 +270,12 @@ def mock_rsr_files(
rsr_dir: Path to store fake RSR files.
rsr_data_version: Version number to use for the created fake RSR files.
By default, the newest/active version number will be used.
+ If ``None`` then no version file is written and no directory created.
+ Note setting to ``None`` will trigger downloads to occur if no further
+ mocking is done. This should only be used to test that downloads do
+ happen when needed. This does not prevent the mocking
+ (see ``side_effect`` and ``return_value``) from making pyspectral
+ think it has the downloads.
central_wavelengths: Dictionary mapping a channel name to a central wavelength
floating point number. This is used to generate more realistic data in the
created fake RSR files. This has no effect if ``side_effect`` or
@@ -278,12 +290,13 @@ def mock_rsr_files(
``central_wavelengths``.
"""
- rsr_dir.mkdir(parents=True, exist_ok=True)
+ if rsr_data_version is not None:
+ rsr_dir.mkdir(parents=True, exist_ok=True)
- rsr_version_path = rsr_dir / RSR_DATA_VERSION_FILENAME
- with rsr_version_path.open("w") as rsr_version_file:
- # defaults to active version, no downloading
- rsr_version_file.write(rsr_data_version)
+ rsr_version_path = rsr_dir / RSR_DATA_VERSION_FILENAME
+ with rsr_version_path.open("w") as rsr_version_file:
+ # defaults to active version, no downloading
+ rsr_version_file.write(rsr_data_version)
with mock.patch("pyspectral.rsr_reader._load_rsr_info_from_file") as load_rsr:
if return_value != "__unset__":
@@ -341,7 +354,7 @@ def mock_rayleigh(
tmp_path_manager = None
if rayleigh_dir is None:
tmp_path_manager = tempfile.TemporaryDirectory(prefix="pyspectral_testing_")
- rayleigh_dir = tmp_path_manager.name
+ rayleigh_dir = Path(tmp_path_manager.name)
if rsr_dir is None:
rsr_dir = rayleigh_dir
=====================================
pyspectral/tests/test_rsr_reader.py
=====================================
@@ -1,15 +1,14 @@
"""Unit testing the generic rsr hdf5 reader."""
from __future__ import annotations
-import contextlib
import unittest
import numpy as np
import pytest
from pyspectral.rsr_reader import RelativeSpectralResponse, RSRDict
-from pyspectral.testing import mock_rsr_files
-from pyspectral.utils import RSR_DATA_VERSION, RSR_DATA_VERSION_FILENAME, WAVE_NUMBER
+from pyspectral.testing import mock_rsr
+from pyspectral.utils import RSR_DATA_VERSION, WAVE_NUMBER
TEST_RSR = {'20': {}, }
TEST_RSR['20']['det-1'] = {}
@@ -72,7 +71,7 @@ def test_convert(tmp_path):
"band_names": list(TEST_RSR.keys()),
"rsr": TEST_RSR,
}
- with mock_rsr_files(tmp_path, return_value=return_value):
+ with mock_rsr(rsr_dir=tmp_path, return_value=return_value):
test_rsr = RelativeSpectralResponse("EOS-Aqua", "modis")
test_rsr.convert()
np.testing.assert_allclose(test_rsr.rsr["20"]["det-1"]["central_wavenumber"], 2647.397, atol=1e-3)
@@ -92,7 +91,7 @@ def test_integral(tmp_path):
"band_names": list(TEST_RSR2.keys()),
"rsr": TEST_RSR,
}
- with mock_rsr_files(tmp_path, return_value=return_value):
+ with mock_rsr(rsr_dir=tmp_path, return_value=return_value):
test_rsr = RelativeSpectralResponse("EOS-Aqua", "modis")
test_rsr.rsr = TEST_RSR2
res = test_rsr.integral("20")
@@ -108,7 +107,7 @@ def test_metadata_from_hdf5_with_platform_instrument(tmp_path):
"band_names": list(TEST_RSR2.keys()),
"rsr": TEST_RSR,
}
- with mock_rsr_files(tmp_path, return_value=return_value):
+ with mock_rsr(rsr_dir=tmp_path, return_value=return_value):
test_rsr = RelativeSpectralResponse("EOS-Aqua", "modis")
assert test_rsr.description == "ABCD"
# platform and instrument are not overwritten by file content
@@ -127,7 +126,7 @@ def test_get_band_from_wavelength(tmp_path):
"band_names": list(TEST_RSR2.keys()),
"rsr": TEST_RSR,
}
- with mock_rsr_files(tmp_path, return_value=return_value):
+ with mock_rsr(rsr_dir=tmp_path, return_value=return_value):
test_rsr = RelativeSpectralResponse("EOS-Aqua", "modis")
assert test_rsr.get_bandname_from_wavelength(3.75) == "20"
@@ -267,48 +266,37 @@ def test_rsr_unconfigured_sensor():
)
def test_get_rsr_from_platform_and_instrument(tmp_path, platform_name, instrument, exp_filename, exp_instrument):
"""Test getting the rsr filename correct when specifying the platform and instrument names."""
- with mock_rsr_files(tmp_path):
+ with mock_rsr(rsr_dir=tmp_path):
test_rsr = RelativeSpectralResponse(platform_name, instrument)
assert test_rsr.platform_name == platform_name
assert test_rsr.instrument == exp_instrument
assert test_rsr.filename.name == exp_filename
+ at pytest.mark.parametrize("version", ["v0.0.0", None])
+def test_rsr_download_from_platform_and_instrument(tmp_path, version):
+ """Test that RSR files are downloaded when not present or not up to date."""
+ with (mock_rsr(rsr_dir=tmp_path, download_from_internet=True, rsr_data_version=version),
+ unittest.mock.patch("pyspectral.rsr_reader.download_rsr") as download):
+ RelativeSpectralResponse("GOES-16", "abi")
+ download.assert_called()
+
+
@pytest.mark.parametrize(
("version", "exp_download"),
[
(RSR_DATA_VERSION, False),
("v1.0.0", True),
+ (None, True),
],
)
def test_check_and_download(tmp_path, version, exp_download):
"""Test that check_and_download only downloads when necessary."""
from pyspectral.rsr_reader import check_and_download
- with _fake_rsr_dir(tmp_path, version), unittest.mock.patch("pyspectral.rsr_reader.download_rsr") as download:
+ with (mock_rsr(rsr_dir=tmp_path, download_from_internet=True, rsr_data_version=version),
+ unittest.mock.patch("pyspectral.rsr_reader.download_rsr") as download):
check_and_download()
if exp_download:
download.assert_called()
else:
download.assert_not_called()
-
-
- at contextlib.contextmanager
-def _fake_rsr_dir(tmp_path, rsr_version):
- with _fake_get_config(tmp_path):
- version_filename = str(tmp_path / RSR_DATA_VERSION_FILENAME)
- with open(version_filename, "w") as version_file:
- version_file.write(rsr_version)
- yield
-
-
- at contextlib.contextmanager
-def _fake_get_config(tmp_path):
- def _get_config():
- return {
- "rayleigh_dir": str(tmp_path),
- "rsr_dir": str(tmp_path),
- "download_from_internet": True,
- }
- with unittest.mock.patch("pyspectral.rsr_reader.get_config") as get_config:
- get_config.side_effect = _get_config
- yield
=====================================
pyspectral/tests/test_testing.py
=====================================
@@ -0,0 +1,45 @@
+"""Tests for the testing utilities in pyspectral.testing."""
+
+import numpy as np
+import pytest
+
+from pyspectral.testing import mock_rayleigh, mock_rsr, mock_tb_conversion
+
+
+ at pytest.mark.parametrize("use_tmp_path", [False, True])
+def test_tb_conversion(tmp_path, use_tmp_path):
+ """Test basic Calculator mocking and path being provided or not."""
+ from pyspectral.near_infrared_reflectance import Calculator
+
+ tp = tmp_path if use_tmp_path else None
+ with mock_tb_conversion(tb2rad_dir=tp, central_wavelengths={"20": 3.75}):
+ refl37 = Calculator("EOS-Aqua", "modis", "20")
+ expected = 2.001793e-08 # unit = "m" (meter)
+ np.testing.assert_allclose(refl37.rsr_integral, expected)
+
+
+ at pytest.mark.parametrize("use_tmp_path", [False, True])
+def test_rsr(tmp_path, use_tmp_path):
+ """Test basic RSR mocking and path being provided or not."""
+ from pyspectral.rsr_reader import RelativeSpectralResponse
+
+ tp = tmp_path if use_tmp_path else None
+ with mock_rsr(rsr_dir=tp):
+ test_rsr = RelativeSpectralResponse("EOS-Aqua", "modis")
+ test_rsr.convert()
+
+
+ at pytest.mark.parametrize("use_tmp_path", [False, True])
+def test_rayleigh(tmp_path, use_tmp_path):
+ """Test basic Rayleigh mocking and path being provided or not."""
+ from pyspectral.rayleigh import Rayleigh
+
+ tp = tmp_path if use_tmp_path else None
+ dtype = np.float32
+ sun_zenith = np.array([67.0, 32.0], dtype=dtype)
+ sat_zenith = np.array([45.0, 18.0], dtype=dtype)
+ azidiff = np.array([150.0, 110.0], dtype=dtype)
+ redband_refl = np.array([14.0, 5.0], dtype=dtype)
+ with mock_rayleigh(rayleigh_dir=tp):
+ rayl = Rayleigh("NOAA-20", "VIIRS", atmosphere="midlatitude summer")
+ rayl.get_reflectance(sun_zenith, sat_zenith, azidiff, "I01", redband_refl)
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/compare/ee4179505752ea2279e5c70412d6dc1b130ea369...343f75167644e7687d1a49ec5d4a882abcd52156
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/pyspectral/-/compare/ee4179505752ea2279e5c70412d6dc1b130ea369...343f75167644e7687d1a49ec5d4a882abcd52156
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/20260207/c784b836/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list