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

Add Scene function to use Hvplot backend visualization #2106

Merged
merged 42 commits into from
Dec 15, 2023

Conversation

bornagain1981
Copy link
Contributor

This pull request is my attempt to do something similar to "to_geoviews" function.
Hvplot syntax is easier than geoviews. In this case input datasets are optional. If no dataset is selected as input all scene variable keys is plotted and available in the output as obj.variable
It is no very fast, especially when there are many datasets and/or high definition coastlines. But for the time being it is ok. Future improvements may be to use multiprocessing library inside the function.

Dario Stelitano added 3 commits May 6, 2022 11:00
New function to plot Scene datasets as Hvplot Overlay
to_hvplot  function plot the  Scene datasets as Hvplot Overlay.
Added Luca Merucci in  authors.md  (we create this function together )
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
@bornagain1981 bornagain1981 changed the title Add Scene function to use Hvplot backend visualisation Add Scene function to use Hvplot backend visualization May 6, 2022
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
@pnuu pnuu added enhancement code enhancements, features, improvements component:scene labels May 6, 2022
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
satpy/scene.py Outdated Show resolved Hide resolved
@bornagain1981
Copy link
Contributor Author

I added hvplot in extra and test sections of setup.py . But hvplot not found error keeps happening

@djhoese
Copy link
Member

djhoese commented May 7, 2022

Add it to https://github.com/pytroll/satpy/blob/main/continuous_integration/environment.yaml

Also, please wrap the import in scene.py in a try/except like:

try:
    import hvplot
except ImportError:
    hvplot = None

then later in your code do something like if hvplot is None: raise ImportError("'hvplot' must be installed to use this feature")

@codecov
Copy link

codecov bot commented May 7, 2022

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (56df5da) 95.35% compared to head (9b0bcae) 95.35%.

Files Patch % Lines
satpy/scene.py 90.90% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2106      +/-   ##
==========================================
- Coverage   95.35%   95.35%   -0.01%     
==========================================
  Files         371      371              
  Lines       52464    52521      +57     
==========================================
+ Hits        50028    50082      +54     
- Misses       2436     2439       +3     
Flag Coverage Δ
behaviourtests 4.15% <3.44%> (-0.01%) ⬇️
unittests 95.97% <94.82%> (-0.01%) ⬇️

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.

@coveralls
Copy link

coveralls commented May 7, 2022

Coverage Status

Coverage: 95.264% (-0.06%) from 95.329% when pulling 09ad15d on bornagain1981:main into b92fe9e on pytroll:main.

@coveralls
Copy link

coveralls commented May 5, 2023

Pull Request Test Coverage Report for Build 7220473626

  • 55 of 58 (94.83%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on main at 95.919%

Changes Missing Coverage Covered Lines Changed/Added Lines %
satpy/scene.py 30 33 90.91%
Totals Coverage Status
Change from base Build 7220123684: 95.9%
Covered Lines: 50208
Relevant Lines: 52344

💛 - Coveralls

satpy/scene.py Outdated
Comment on lines 1115 to 1116
if hvplot_xarray is None:
raise ImportError("'hvplot' must be installed to use this feature")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if hvplot_xarray is None:
raise ImportError("'hvplot' must be installed to use this feature")
import hvplot.xarray as hvplot_xarray

@bornagain1981
Copy link
Contributor Author

I added the holoviews module in setup file but Sphinx keep reporting "missing module error"

@bornagain1981
Copy link
Contributor Author

Couple more requests after running the code. And the tests :-)

I added the tests :)

Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM!

@mraspaud mraspaud merged commit 7d1810b into pytroll:main Dec 15, 2023
16 of 19 checks passed
@djhoese
Copy link
Member

djhoese commented Dec 15, 2023

Could we please get a follow up pull request that moves this functionality to a function in:

https://github.com/pytroll/satpy/blob/main/satpy/_scene_converters.py

This is a lot of code to add to an already bloated scene.py module. This _scene_converters.py module was created (admittedly after this PR was started but before it was merged) as a "dumping ground" for these types of conversions.

bornagain1981 pushed a commit to bornagain1981/satpy that referenced this pull request Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:scene enhancement code enhancements, features, improvements
Projects
Development

Successfully merging this pull request may close these issues.

7 participants