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

Encode header attributes in CF writer #953

Merged
merged 7 commits into from Oct 30, 2019

Conversation

sfinkens
Copy link
Member

@sfinkens sfinkens commented Oct 25, 2019

This PR introduces encoding of header attributes in the CF writer. The same methods are employed as for dataset attributes (i.e. the standard json encoder plus some extra rules). This also fixes the problem of zero-valued header attributes not being included in the global nc attributes.

Furthermore, I harmonized the encoding of bool and np.bool_ attributes. Currently we have "True" for np.bool_ and "true" for boolean. I chose "true" and "false" because that is the json default.

  • Tests added and test suite added to parent suite
  • Tests passed
  • Passes flake8 satpy

Header attributes equal to zero were not included in the global
nc attributes.
@coveralls
Copy link

coveralls commented Oct 25, 2019

Coverage Status

Coverage increased (+0.4%) to 86.593% when pulling e4e8584 on sfinkens:fix-cf-writer-header-attrs into 287cffd on pytroll:master.

@codecov
Copy link

codecov bot commented Oct 25, 2019

Codecov Report

Merging #953 into master will increase coverage by 0.4%.
The diff coverage is 95.65%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #953     +/-   ##
=========================================
+ Coverage   86.19%   86.59%   +0.4%     
=========================================
  Files         174      175      +1     
  Lines       26740    26837     +97     
=========================================
+ Hits        23048    23239    +191     
+ Misses       3692     3598     -94
Impacted Files Coverage Δ
satpy/writers/cf_writer.py 91.24% <100%> (-0.2%) ⬇️
satpy/tests/writer_tests/test_cf.py 98.37% <92.3%> (-0.2%) ⬇️
satpy/readers/__init__.py 93.07% <0%> (-1.21%) ⬇️
satpy/scene.py 90.35% <0%> (-0.18%) ⬇️
satpy/tests/reader_tests/test_viirs_compact.py 94.33% <0%> (ø)
satpy/tests/reader_tests/__init__.py 98.24% <0%> (+0.03%) ⬆️
satpy/readers/file_handlers.py 97.01% <0%> (+2.98%) ⬆️
satpy/readers/viirs_compact.py 64.56% <0%> (+49.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 287cffd...e4e8584. Read the comment docs.

@sfinkens sfinkens changed the title Fix handling of header attributes in CF writer Encode header attributes in CF writer Oct 28, 2019
@sfinkens sfinkens added the enhancement code enhancements, features, improvements label Oct 29, 2019
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 42d1c6a into pytroll:master Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component:writers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants