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 option to smooth radar mask #379

Merged
merged 11 commits into from
Jul 18, 2024
Merged

Add option to smooth radar mask #379

merged 11 commits into from
Jul 18, 2024

Conversation

sidekock
Copy link
Contributor

Solution for #377

Addition done by adding a cv2 based method in blending.utils.py called compute_smooth_dilated_mask(...).

This function can be used in the blending.steps.forecast by changing the create_smooth_radar_mask parameter to True, standard this is put to False to not create conflicts with existing code.

…n of another parameter called 'create_smooth_radar_mask'. The actual implimentation of the code can be found in the blending utils
@sidekock sidekock added the enhancement New feature or request label Jul 16, 2024
@sidekock sidekock requested a review from dnerini July 16, 2024 12:11
@sidekock sidekock self-assigned this Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.67%. Comparing base (953f799) to head (3ccfc0b).
Report is 2 commits behind head on master.

Files Patch % Lines
pysteps/blending/utils.py 87.50% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #379      +/-   ##
==========================================
+ Coverage   83.52%   83.67%   +0.15%     
==========================================
  Files         159      159              
  Lines       12575    12649      +74     
==========================================
+ Hits        10503    10584      +81     
+ Misses       2072     2065       -7     
Flag Coverage Δ
unit_tests 83.67% <92.59%> (+0.15%) ⬆️

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.

pysteps/blending/steps.py Outdated Show resolved Hide resolved
pysteps/blending/steps.py Outdated Show resolved Hide resolved
pysteps/blending/steps.py Show resolved Hide resolved
pysteps/blending/steps.py Outdated Show resolved Hide resolved
@sidekock
Copy link
Contributor Author

@RubenImhoff suggested to add some figures of the effect of the smooth mask on the final product. Below I attach a figure with 3 version: one without a smooth edge (current product), one with a smooth edge with a maximum range of 50 px (=50km) and one with a max range of 80km.
Screenshot from 2024-07-17 16-41-04

…an blended mask. Fixed by aplying the smooth mask to the lagrangian blended reference nowcast (R_pm_blended)
Copy link
Member

@dnerini dnerini left a comment

Choose a reason for hiding this comment

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

Looking good! I have few more minor comments. Some simple testing and then I think this I will be ready to go!

pysteps/blending/steps.py Outdated Show resolved Hide resolved
pysteps/blending/steps.py Show resolved Hide resolved
pysteps/blending/steps.py Show resolved Hide resolved
pysteps/blending/steps.py Outdated Show resolved Hide resolved
@dnerini dnerini changed the title Smooth radar mask Add option to smooth radar mask Jul 17, 2024
pysteps/blending/steps.py Outdated Show resolved Hide resolved
pysteps/blending/utils.py Outdated Show resolved Hide resolved
@RubenImhoff
Copy link
Contributor

I think we're almost there - I'm working on adding some extra tests. :)

@RubenImhoff RubenImhoff self-assigned this Jul 18, 2024
Copy link
Contributor

@RubenImhoff RubenImhoff left a comment

Choose a reason for hiding this comment

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

I think all issues have been solved now and we have sufficient test coverage. We can merge this PR now. Nice contribution! :)

@RubenImhoff RubenImhoff requested a review from dnerini July 18, 2024 14:01
Copy link
Member

@dnerini dnerini left a comment

Choose a reason for hiding this comment

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

Well done!

@dnerini dnerini merged commit d77fe73 into master Jul 18, 2024
10 checks passed
@RubenImhoff RubenImhoff deleted the smooth_radar_mask branch July 18, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Create smooth transition between cells within and outside the radar domain during blending
3 participants