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

Fix default AWIPS tiled _FillValue of -1 for newer versions of xarray #2858

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jul 17, 2024

Fixes compatibility with (currently unstable) xarray for the AWIPS tiled (awips_tiled) writer when using the default _Unsigned fill value of -1. Starting with

pydata/xarray#9136

Xarray automatically converts the _FillValue to the proper dtype in a way that does not allow (or rather numpy does not allow) certain values to be automatically cast between types. In the case of this -1 it was trying to cast it directly to the unsigned type (give or take some bit depth differences) and failing. The -1 was just a convenience in the writer code anyway. I've added the necessary code to specify the fill value as the unsigned numpy type so that xarray can convert it when the file is saved.

  • Closes #xxxx
  • Tests added
  • Fully documented
  • Add your name to AUTHORS.md if not there already

@djhoese
Copy link
Member Author

djhoese commented Jul 17, 2024

Merging this could wait a bit for the discussion in the xarray PR to settle to know if this is needed at all. Either way, the datetime change in this PR should be included.

Copy link

codecov bot commented Jul 17, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.95%. Comparing base (4011541) to head (b62f10b).
Report is 454 commits behind head on main.

Files with missing lines Patch % Lines
satpy/writers/awips_tiled.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2858      +/-   ##
==========================================
- Coverage   95.95%   95.95%   -0.01%     
==========================================
  Files         366      366              
  Lines       53619    53617       -2     
==========================================
- Hits        51452    51448       -4     
- Misses       2167     2169       +2     
Flag Coverage Δ
behaviourtests 4.04% <0.00%> (-0.01%) ⬇️
unittests 96.05% <66.66%> (-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.

@coveralls
Copy link

coveralls commented Jul 17, 2024

Pull Request Test Coverage Report for Build 9979397064

Details

  • 2 of 3 (66.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.054%

Changes Missing Coverage Covered Lines Changed/Added Lines %
satpy/writers/awips_tiled.py 2 3 66.67%
Totals Coverage Status
Change from base Build 9973181832: 0.0%
Covered Lines: 51677
Relevant Lines: 53800

💛 - 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.

LGTM

@mraspaud mraspaud merged commit 2e2418f into pytroll:main Jul 19, 2024
17 of 19 checks passed
@djhoese
Copy link
Member Author

djhoese commented Jul 19, 2024

Oh I should have made this a draft instead of just posting my previouscomment. I have an xarray PR that should make this unnecessary.

@mraspaud
Copy link
Member

Ah, sorry, missed the comment...

@djhoese djhoese deleted the bugfix-awipstiled-xarray-compat branch July 20, 2024 02:04
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.

3 participants