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 ABI L1b/L2 time dimension causing issues with newer xarray #1036

Merged
merged 2 commits into from Jan 9, 2020

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Jan 8, 2020

Pointed out originally by @TAlonglong on slack. @yufeizhu600 also helped debug this one.

It seems in newer versions of xarray that the scalar variables in a NetCDF variable like t in the ABI L1b files is no longer treated as a dimension (self.nc.dims) and is only considered a coordinate variable. The ABI base reader specifically checked for it existing in the dims before renaming it to time to be more compatible with the rest of Satpy. This PR fixes this by checking the .dims and the .coords for a t variable. Continuing to check in .dims may be redundant, but I think it is useful in the case there is a declared dimension in a NetCDF file but no corresponding coordinate variable defined in the file.

To test this I had to update the ABI L1b/L2 and GLM L2 tests to stop using a "FakeDataset" object when a normal xarray Dataset object will do just fine.

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

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 87.296% when pulling e9c1a53 on djhoese:bugfix-abi-t-dimension into 2f9501e on pytroll:master.

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #1036 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1036      +/-   ##
==========================================
+ Coverage   87.29%   87.29%   +<.01%     
==========================================
  Files         188      188              
  Lines       28742    28715      -27     
==========================================
- Hits        25089    25067      -22     
+ Misses       3653     3648       -5
Impacted Files Coverage Δ
satpy/tests/reader_tests/test_glm_l2.py 95.16% <100%> (+0.28%) ⬆️
satpy/readers/abi_base.py 91.6% <100%> (+3.05%) ⬆️
satpy/tests/reader_tests/test_abi_l2_nc.py 93.93% <100%> (+0.09%) ⬆️
satpy/tests/reader_tests/test_abi_l1b.py 96.87% <100%> (-0.35%) ⬇️

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 2f9501e...e9c1a53. Read the comment docs.

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 c2de7cc into pytroll:master Jan 9, 2020
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.

None yet

3 participants