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

Geogrid fix #340

Merged
merged 4 commits into from
Dec 20, 2023
Merged

Geogrid fix #340

merged 4 commits into from
Dec 20, 2023

Conversation

dbkhout
Copy link
Contributor

@dbkhout dbkhout commented Dec 19, 2023

While only used for visualization, the get_geogrid and reproject_geodata functions seem to be slightly off.

The functions use np.linspace to retrieve the lower boundary for each pixel based on the number of pixels and the extent of the image (e.g. x1, x2). In doing so, x2 should be excluded from the interval as it represents the upper boundary of the image.


Illustration:

np.linspace(3, 10, 7) returns 3., 4.16666667, 5.33333333, 6.5, 7.66666667, 8.83333333, 10. while 3., 4., 5., 6., 7., 8., 9. is expected.

np.linspace(3, 10, 7, endpoint=False) does return the expected result.


Note that this has been accounted for correctly (yet with different approaches) in other pysteps functions:

np.linspace(left, right - metadata["xpixelsize"], R.shape[3])

xr = np.linspace(metadata["x1"], metadata["x2"], w + 1)[:-1]

Copy link

codecov bot commented Dec 20, 2023

Codecov Report

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

Comparison is base (71fa354) 83.33% compared to head (c8103a7) 83.32%.
Report is 4 commits behind head on master.

Files Patch % Lines
pysteps/visualization/utils.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #340      +/-   ##
==========================================
- Coverage   83.33%   83.32%   -0.01%     
==========================================
  Files         161      161              
  Lines       12358    12356       -2     
==========================================
- Hits        10298    10296       -2     
  Misses       2060     2060              
Flag Coverage Δ
unit_tests 83.32% <50.00%> (-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.

@dnerini
Copy link
Member

dnerini commented Dec 20, 2023

hi @dbkhout thanks for the PR! Tests are failing for macos and windows, but it's probably unrelated from your changes. I'll have a closer look asap and will let you know

@dnerini dnerini self-requested a review December 20, 2023 13:25
@dnerini
Copy link
Member

dnerini commented Dec 20, 2023

@dbkhout could you please merge the latest version of pysteps/master in your branch? This should fix the errors in the CI pipelines

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 and all tests are green now (we can ignore the coverage in this case)! Thanks again for the nice fix :-)

@dnerini dnerini merged commit 61b1b4f into pySTEPS:master Dec 20, 2023
8 of 10 checks passed
@dbkhout
Copy link
Contributor Author

dbkhout commented Dec 20, 2023

You're welcome, thanks for the quick reaction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants