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

CF-compliant storage for lon/lat case #2236

Merged
merged 9 commits into from
Oct 21, 2022
Merged

Conversation

gerritholl
Copy link
Collaborator

@gerritholl gerritholl commented Oct 13, 2022

Store datasets with an area using a geodetic CRS (unprojected longitude/latitude) in a CF-compliant way.

Work in progress.

Test that datasets are stored in a CF-compliant way when the area has
a geodetic (unprojected) CRS, such as a CRS described in latitude and
longitude.

The test is currently failing due to pytroll#2227.
In the CF lonlat test, make sure the test scene dataset has CRS and x/y
coordinates like a real scene.
Add a test for the da2cf encoding when the area has lon/lat coordinates.
When we have a lon/lat grid mapping, write the coordinate units as
degrees rather than metre.  This commit also includes some refactoring
in cf_writer.py.
@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Merging #2236 (03e9868) into main (e7d24a3) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2236      +/-   ##
==========================================
+ Coverage   94.12%   94.16%   +0.03%     
==========================================
  Files         294      294              
  Lines       45189    45279      +90     
==========================================
+ Hits        42536    42635      +99     
+ Misses       2653     2644       -9     
Flag Coverage Δ
behaviourtests 4.66% <1.92%> (+<0.01%) ⬆️
unittests 94.81% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
satpy/tests/utils.py 94.62% <100.00%> (+0.24%) ⬆️
satpy/tests/writer_tests/test_cf.py 99.71% <100.00%> (+0.01%) ⬆️
satpy/writers/cf_writer.py 95.16% <100.00%> (+0.54%) ⬆️
satpy/tests/test_config.py 97.18% <0.00%> (+0.40%) ⬆️
satpy/tests/reader_tests/test_vii_base_nc.py 100.00% <0.00%> (+1.24%) ⬆️
satpy/tests/reader_tests/test_nwcsaf_msg.py 100.00% <0.00%> (+1.80%) ⬆️
satpy/tests/reader_tests/test_vii_l1b_nc.py 100.00% <0.00%> (+2.81%) ⬆️
satpy/tests/reader_tests/test_vii_l2_nc.py 100.00% <0.00%> (+6.06%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Refactor the make_fake_scene helper function to reduce the cyclomatic
complexity.
@coveralls
Copy link

coveralls commented Oct 14, 2022

Coverage Status

Coverage increased (+0.01%) to 94.759% when pulling 03e9868 on gerritholl:cf-lonlat into e7d24a3 on pytroll:main.

Refactor CFWriter._is_projected to reduce the cyclomatic complexity
Fix a bug in make_fake_scene that I introduced while refactoring.
Passing area=False will now once again return a scene without areas
defined.
@gerritholl gerritholl marked this pull request as ready for review October 14, 2022 13:41
@djhoese djhoese added enhancement code enhancements, features, improvements component:writers bug and removed enhancement code enhancements, features, improvements labels Oct 14, 2022
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.

I'm a little nervous by the moving of the two _encode_X calls, but since the tests aren't failing then I guess we'll find out later if it is a problem.

Looks good to me. Thanks for fixing it.

satpy/writers/cf_writer.py Show resolved Hide resolved
Improve the test coverage after refactoring the CF writer, now testing
more cases when units are provided but no area.
@gerritholl gerritholl merged commit f950b87 into pytroll:main Oct 21, 2022
@gerritholl gerritholl deleted the cf-lonlat branch October 21, 2022 15:49
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

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.

CF writer output wrong for area with geographic CRS
4 participants