From 1f990ca47bf4e9c5ded625c8207a5123b175409f Mon Sep 17 00:00:00 2001 From: "Adam.Dybbroe" Date: Sun, 27 Oct 2024 18:35:13 +0100 Subject: [PATCH 1/2] Allow for similar (overlapping) bands - and don't just ignore all others than the first found Signed-off-by: Adam.Dybbroe --- bin/composite_rsr_plot.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/bin/composite_rsr_plot.py b/bin/composite_rsr_plot.py index 0efcfcbd..206872df 100644 --- a/bin/composite_rsr_plot.py +++ b/bin/composite_rsr_plot.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- # -# Copyright (c) 2016-2022 Pytroll developers +# Copyright (c) 2016-2022, 2024 Pytroll developers # # # This program is free software: you can redistribute it and/or modify @@ -184,24 +184,21 @@ def get_arguments(): else: wvlx = wvlmin - prev_band = None + prev_bands = [] while wvlx < wvlmax: bands = rsr.get_bandname_from_wavelength(wvlx, wavel_res, multiple_bands=True) - - if isinstance(bands, list): - b__ = bands[0] - for b in bands[1:]: - LOG.warning("Skipping band %s", str(b)) - else: - b__ = bands - wvlx = wvlx + wavel_res / 5. - if not b__: + if not bands: continue - if b__ != prev_band: - plt = plot_band(plt, b__, rsr, - platform_name_in_legend=(not no_platform_name_in_legend)) - prev_band = b__ + + if not isinstance(bands, list): + bands = [bands] + + for b__ in bands: + if b__ not in prev_bands: + plt = plot_band(plt, b__, rsr, + platform_name_in_legend=(not no_platform_name_in_legend)) + prev_bands.append(b__) if not something2plot: LOG.error("Nothing to plot!") From 8ca1082af82d0da7bd434e2599b87d04be9197f7 Mon Sep 17 00:00:00 2001 From: "Adam.Dybbroe" Date: Fri, 13 Dec 2024 12:32:44 +0100 Subject: [PATCH 2/2] Add option to exclude band names from the plotting Signed-off-by: Adam.Dybbroe --- bin/composite_rsr_plot.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/composite_rsr_plot.py b/bin/composite_rsr_plot.py index 206872df..3fc26ac8 100644 --- a/bin/composite_rsr_plot.py +++ b/bin/composite_rsr_plot.py @@ -103,6 +103,11 @@ def get_arguments(): help="The wavelength range for the plot", default=[None, None], type=float) + parser.add_argument("--exclude_bandnames", nargs='*', + default=[], + required=False, + help="Sensor band names to exclude from the plot", type=str) + return parser.parse_args() @@ -139,6 +144,8 @@ def get_arguments(): elif args.wavelength: req_wvl = args.wavelength + excluded_bandnames = args.exclude_bandnames + figscale = 1.0 if wvlmin: figscale = (wvlmax - wvlmin) / 4. @@ -195,7 +202,7 @@ def get_arguments(): bands = [bands] for b__ in bands: - if b__ not in prev_bands: + if b__ not in excluded_bandnames and b__ not in prev_bands: plt = plot_band(plt, b__, rsr, platform_name_in_legend=(not no_platform_name_in_legend)) prev_bands.append(b__)