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

Update AHI HSD reader to correctly handle singleton arrays. #2682

Merged
merged 4 commits into from
Dec 12, 2023

Conversation

simonrp84
Copy link
Member

@simonrp84 simonrp84 commented Dec 12, 2023

Recently, one of the libraries used by satpy (I think numpy) has started warning about conversion of arrays to scalar:

C:\Users\Simon\PycharmProjects\satpy\satpy\readers\ahi_hsd.py:422: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  return datetime(1858, 11, 17) + timedelta(days=float(self.basic_info["observation_start_time"]))

This PR updates the ahi_hsd reader and tests to remove the warning by selecting the first element of the relevant array. As the array only has one element, this means there's no change in any results on the user-side.

  • Tests added

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f4725c2) 95.32% compared to head (3f55256) 95.32%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2682   +/-   ##
=======================================
  Coverage   95.32%   95.32%           
=======================================
  Files         371      371           
  Lines       52441    52441           
=======================================
  Hits        49988    49988           
  Misses       2453     2453           
Flag Coverage Δ
behaviourtests 4.16% <0.00%> (ø)
unittests 95.93% <100.00%> (ø)

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 Dec 12, 2023

Pull Request Test Coverage Report for Build 7183035793

  • 17 of 17 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 95.886%

Totals Coverage Status
Change from base Build 7180375207: 0.0%
Covered Lines: 50114
Relevant Lines: 52264

💛 - Coveralls

Copy link
Member

@sfinkens sfinkens left a comment

Choose a reason for hiding this comment

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

Nice work, thanks a lot!

satpy/readers/ahi_hsd.py Outdated Show resolved Hide resolved
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!

@simonrp84
Copy link
Member Author

Ooops, I messed up the tests. Should be fixed now.

@mraspaud mraspaud merged commit 9925d5f into pytroll:main Dec 12, 2023
18 of 19 checks passed
@simonrp84 simonrp84 deleted the ahi_fix branch December 12, 2023 15:29
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.

4 participants