Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG_RSR_DATA.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Changelog for the Relative Spectral Response data
=================================================

Version v1.6.1 (Wed Apr 1 08:14:23 PM CEST 2026)

-------------------------------------------

* Bugfix adding the new MODIS RSR files and now also with an extra attribute
for the sensor name


Version v1.6.0 (Mon Mar 30 06:58:54 PM CEST 2026)

-------------------------------------------

* Updated the MODIS RSR files with new platform names, Terra and Aqua instead
of the previous EOS-Terra and EOS-Aqua, see the WMO OSCAR database


Version v1.5.1 (Mon Mar 9 09:13:07 PM CET 2026)

-------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions bin/composite_rsr_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

"""

import logging

import matplotlib.pyplot as plt
import numpy as np

from pyspectral.rsr_reader import RelativeSpectralResponse
from pyspectral.utils import INSTRUMENTS, get_logger, logging_off, logging_on
from pyspectral.utils import INSTRUMENTS, get_logger, logging_on


def plot_band(plt_in, band_name, rsr_obj, **kwargs):
Expand Down Expand Up @@ -114,7 +116,7 @@ def get_arguments():
if verbose:
logging_on()
else:
logging_off()
logging_on(level=logging.ERROR)

req_wvl = None
band = None
Expand All @@ -141,8 +143,8 @@ def get_arguments():
try:
rsr = RelativeSpectralResponse(platform, sensor)
except IOError:
# LOG.exception('Failed getting the rsr data for platform %s ' +
# 'and sensor %s', platform, sensor)
LOG.exception('Failed getting the rsr data for platform %s ' +
'and sensor %s', platform, sensor)
rsr = None
else:
break
Expand Down
7 changes: 4 additions & 3 deletions pyspectral/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
"Metop-SG-A1": "metimage",
"EOS-Aqua": "modis",
"EOS-Terra": "modis",
"Aqua": "modis",
"Terra": "modis",
"Sentinel-2A": "msi",
"Sentinel-2B": "msi",
"Sentinel-2C": "msi",
Expand Down Expand Up @@ -93,10 +95,9 @@
"avhrr-2": "avhrr/2",
"avhrr-3": "avhrr/3"}

HTTP_PYSPECTRAL_RSR = "https://zenodo.org/records/18928854/files/pyspectral_rsr_data.tgz"

HTTP_PYSPECTRAL_RSR = "https://zenodo.org/records/19373017/files/pyspectral_rsr_data.tgz"
RSR_DATA_VERSION_FILENAME = "PYSPECTRAL_RSR_VERSION"
RSR_DATA_VERSION = "v1.5.1"
RSR_DATA_VERSION = "v1.6.1"


ATM_CORRECTION_LUT_VERSION = {}
Expand Down
69 changes: 69 additions & 0 deletions rsr_convert_scripts/modis_old2new_rsr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2026 Pytroll developers

# This program is free software: you can redistribute it and/or modify
# 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/>.

"""Script to convert Pyspectral internal Terra/Aqua RSR files.

Read the internally generated hdf5 file with MODIS RSR and fix platform name
and write to a new file.

"""

import shutil
from pathlib import Path

import h5py


def get_arguments():
"""Get the command line arguments."""
import argparse
parser = argparse.ArgumentParser(
description='Convert old modis files to new ones using the platform names now standard at WMO Oscar')

parser.add_argument("--directory", '-d',
help="The directory path to where the old EOS-Aqua/EOS-Terra RSR files are stored",
type=str, required=True)

return parser.parse_args()


if __name__ == "__main__":

args = get_arguments()
basedir = args.directory

for satname in ['Aqua', 'Terra']:
OLD_MODIS_FILE = Path(basedir) / f'rsr_modis_EOS-{satname}.h5'
NEW_MODIS_FILE = Path(basedir) / f'rsr_modis_{satname}.h5'
shutil.copy(OLD_MODIS_FILE, NEW_MODIS_FILE)

remove_attrs = ["platform", "sat_number"]
new_attrs = {
"sensor": "modis",
"platform_name": satname,
}

with h5py.File(NEW_MODIS_FILE, "r+") as f:
# Remove
for key in remove_attrs:
if key in f.attrs:
del f.attrs[key]

# Add/update
for key, value in new_attrs.items():
f.attrs[key] = value
Loading