Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rsr plotting to allow for similar (overlapping) bands #240

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

adybbroe
Copy link
Collaborator

@adybbroe adybbroe commented Oct 27, 2024

Fix the script to plot spectral response functions, allowing for similar (overlapping) bands - and don't just ignore all others than the first found.

  • Closes #xxxx
  • Tests added
  • Tests passed: Passes pytest pyspectral
  • Passes flake8 pyspectral
  • Fully documented
  • Add your name to AUTHORS.md if not there already

…ers than the first found

Signed-off-by: Adam.Dybbroe <[email protected]>
@adybbroe adybbroe self-assigned this Oct 27, 2024
Copy link

codecov bot commented Oct 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.25%. Comparing base (279c2c2) to head (8ca1082).
Report is 16 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #240   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files          22       22           
  Lines        2515     2515           
=======================================
  Hits         2270     2270           
  Misses        245      245           
Flag Coverage Δ
unittests 90.25% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adybbroe adybbroe marked this pull request as ready for review October 29, 2024 14:06
@adybbroe
Copy link
Collaborator Author

adybbroe commented Dec 13, 2024

For instance, now you can do:

%> python bin/composite_rsr_plot.py --platform_name Meteosat-11 Meteosat-12 NOAA-21 --sensor seviri fci viirs -r 10.5 12.5 -v --exclude_bandnames I5

Which will produce this plot:
rsr_band_1050_1250

Leaving out the last --exclude_bandnames option above would have resultet in this plot:

rsr_band_1050_1250_with_i5

@djhoese
Copy link
Member

djhoese commented Dec 13, 2024

Maybe it's just me but those quicklooks aren't working. They still say "Uploading ...png...". Did you maybe close the tab before they were fully uploaded?

@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required is not necessary here. The default is False. Actually type=str is also not necessary as str is the default type.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change requested. I don't understand the code before or after this PR so I'm not sure I should give my opinion too strongly. The code "smells" like there should be a simpler way, but if it works for you then 👍.

Possible simplification: Could you have a function that gets all the bands needed to be plotted and would take the wavelength and band information in as input and produce a list of bands?

Copy link
Member

@simonrp84 simonrp84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'm not expert enough to figure out how to do what Dave asks but they appear like reasonable suggestions if you have time. If not, happy to see it merged as-is.

@adybbroe
Copy link
Collaborator Author

Maybe it's just me but those quicklooks aren't working. They still say "Uploading ...png...". Did you maybe close the tab before they were fully uploaded?

You were right, sorry, should work now

@djhoese
Copy link
Member

djhoese commented Dec 16, 2024

@adybbroe Can you fix the title of the PR. It got cut off from your commit message it seems.

For your quicklooks, yes I see them, but now I'm not sure what you are trying to show. Prior to this PR the code would just ignore I5? Or would it fail because two wavelengths matched for a single VIIRS instrument?

And now? Now you don't need the exclude I5 because it can be plotted without issue?

@adybbroe adybbroe changed the title Allow for similar (overlapping) bands - and don't just ignore all oth… Fix rsr plotting to allow for similar (overlapping) bands Dec 16, 2024
@adybbroe
Copy link
Collaborator Author

Small change requested. I don't understand the code before or after this PR so I'm not sure I should give my opinion too strongly. The code "smells" like there should be a simpler way, but if it works for you then 👍.

Possible simplification: Could you have a function that gets all the bands needed to be plotted and would take the wavelength and band information in as input and produce a list of bands?

I believe you have a sharp nose! I think you might be right. Will think another day on this, and either start simplify, or merge and make an issue, or just merge :-)

@adybbroe adybbroe merged commit 2a89746 into pytroll:main Dec 18, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants