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

Avoid accidental NWCSAF-GEO type promotion #2874

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

gerritholl
Copy link
Collaborator

@gerritholl gerritholl commented Aug 6, 2024

Avoid accidentally promoting the type in the NWCSAF GEO reader.

WARNING: Needs pytroll/trollimage#176 !

Added a test to make sure that cloud type (or others) are not
accidentally transformed to an inflated dtype.

This currently fails with numpy 2.0; see
pytroll#2872
Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.97%. Comparing base (f3a2343) to head (7a29463).
Report is 249 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2874   +/-   ##
=======================================
  Coverage   95.97%   95.97%           
=======================================
  Files         368      368           
  Lines       53973    53982    +9     
=======================================
+ Hits        51801    51810    +9     
  Misses       2172     2172           
Flag Coverage Δ
behaviourtests 4.02% <0.00%> (-0.01%) ⬇️
unittests 96.07% <100.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.

Make sure that integer dtypes when reading NWCSAF GEO are not
accidentally cast to int64.
@gerritholl gerritholl marked this pull request as ready for review August 6, 2024 15:16
@gerritholl gerritholl marked this pull request as draft August 6, 2024 15:23
@gerritholl
Copy link
Collaborator Author

Oops 1: with this pull request, loading and computing cloudtype fails with ValueError on numpy 2.0.

Oops 2: this appears to be not caught by any tests.

@djhoese
Copy link
Member

djhoese commented Aug 6, 2024

Oops

Nevermind then, I don't approve 😉

@coveralls
Copy link

Pull Request Test Coverage Report for Build 10269258953

Details

  • 12 of 12 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.073%

Totals Coverage Status
Change from base Build 10259110188: 0.0%
Covered Lines: 52039
Relevant Lines: 54166

💛 - Coveralls

@gerritholl
Copy link
Collaborator Author

The ValueError is due to a numpy2-incompatibility in trollimage:

https://github.com/pytroll/trollimage/blob/main/trollimage/colormap.py#L182

outside_range_bin = max(np.nanmax(arr), values.max()) + 1

numpy 1.24: uint8(255) + 1 == int64(256)

numpy 2.0: uint8(255) + 1 = uint8(0)

@gerritholl gerritholl marked this pull request as ready for review August 7, 2024 07:36
@gerritholl
Copy link
Collaborator Author

Oops

Nevermind then, I don't approve 😉

Fixed with pytroll/trollimage#176.

@mraspaud mraspaud merged commit 8d5a6a2 into pytroll:main Aug 15, 2024
17 of 18 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.

nwcsaf-geo reader turns uint8 into int64 on numpy 2.0
4 participants