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

Convert times in SEVIRI readers to nanosecond precision to silence warnings #2676

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Dec 11, 2023

The SEVIRI readers (at least for HRIT) issues a ton of warnings about not having nanosecond precision for the times passed to DataArray. This PR converts the times to ns precision to silence the warnings, and separates the three associated tests.

  • Tests added

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you!

@djhoese djhoese added the cleanup Code cleanup but otherwise no change in functionality label Dec 11, 2023
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d90acf5) 95.30% compared to head (df26a58) 95.32%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2676      +/-   ##
==========================================
+ Coverage   95.30%   95.32%   +0.02%     
==========================================
  Files         371      371              
  Lines       52435    52441       +6     
==========================================
+ Hits        49971    49988      +17     
+ Misses       2464     2453      -11     
Flag Coverage Δ
behaviourtests 4.16% <0.00%> (+<0.01%) ⬆️
unittests 95.93% <100.00%> (+0.02%) ⬆️

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 11, 2023

Pull Request Test Coverage Report for Build 7170478391

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

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

Files with Coverage Reduction New Missed Lines %
satpy/writers/awips_tiled.py 75 84.01%
Totals Coverage Status
Change from base Build 7168284023: 0.0%
Covered Lines: 50114
Relevant Lines: 52264

💛 - Coveralls

np.testing.assert_equal(get_cds_time(days=days, msecs=msecs), expected)
res = get_cds_time(days=days, msecs=msecs)
np.testing.assert_equal(res, expected)
assert ".000000000" in res.__repr__()
Copy link
Member

Choose a reason for hiding this comment

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

Does this test the dtype? Can this be tested directly, instead of indirectly via string representation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, the dtype is dtype('<M8[ns]'). There is also the ns part, but I need to dig a bit more (hopefully tomorrow) to find the best way.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting, I thought the precision was more easily accessible. What about

>>> a.dtype.name
'datetime64[ns]'

Copy link
Member

Choose a reason for hiding this comment

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

Or simply

a.dtype == np.dtype("datetime64[ns]")

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, that's nice!

Copy link
Member Author

Choose a reason for hiding this comment

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

Adjusted in df26a58

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.

LGTM, thanks for fixing this!

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 f4725c2 into pytroll:main Dec 12, 2023
18 of 19 checks passed
@pnuu pnuu deleted the seviri-nanosecond-times branch December 15, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code cleanup but otherwise no change in functionality component:readers
Projects
Development

Successfully merging this pull request may close these issues.

5 participants