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

Reduce the number of warnings in writer tests #2691

Merged
merged 7 commits into from
Dec 15, 2023

Conversation

pnuu
Copy link
Member

@pnuu pnuu commented Dec 15, 2023

Update the code where possible, suppress where necessary, to reduce the number of warnings in Satpy writer tests. The remaining are CF version dependant and various Numpy RuntimeWarnings.

  • Tests adjusted

@pnuu pnuu added component:writers cleanup Code cleanup but otherwise no change in functionality labels Dec 15, 2023
@pnuu pnuu self-assigned this Dec 15, 2023
@pnuu
Copy link
Member Author

pnuu commented Dec 15, 2023

The number of warnings went from 182 to 101. Not as bit a reduction as expected, but there are plenty of Numpy warnings I didn't tackle here.

Copy link

codecov bot commented Dec 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4076e99) 95.35% compared to head (612e927) 95.35%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2691   +/-   ##
=======================================
  Coverage   95.35%   95.35%           
=======================================
  Files         371      371           
  Lines       52400    52415   +15     
=======================================
+ Hits        49964    49979   +15     
  Misses       2436     2436           
Flag Coverage Δ
behaviourtests 4.16% <0.00%> (-0.01%) ⬇️
unittests 95.97% <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.

@pnuu pnuu changed the title Reduce the numer of warnings in writer tests Reduce the number of warnings in writer tests Dec 15, 2023
@coveralls
Copy link

Pull Request Test Coverage Report for Build 7219848054

  • 36 of 36 (100.0%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 95.917%

Totals Coverage Status
Change from base Build 7209861856: 0.001%
Covered Lines: 50105
Relevant Lines: 52238

💛 - Coveralls

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.

Looks good, just a question

attrs=dict(start_time=start_time,
end_time=end_time))
with TempFile() as filename:
scn.save_datasets(filename=filename, writer="cf")
with warnings.catch_warnings():
# The purpose is to use the default time encoding, silence the warning
Copy link
Member

Choose a reason for hiding this comment

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

so the default time encoding triggers a warning?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the default of xarray.coding.times.CFDatetimeCoder seems to be days since <epoch> and the datatype we end up is integers, so fractional days are not possible without the library converting to float. I don't know how the time dtype would be set to float by us, and this was the only case I saw of this warning so didn't use much time investigating.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, so then maybe something for the next iteration of warning smashing.

@mraspaud mraspaud merged commit 9f74871 into pytroll:main Dec 15, 2023
18 of 19 checks passed
@pnuu pnuu deleted the writer-warnings branch December 15, 2023 12:29
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:writers
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants