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 mersi 2 angles reading #1407

Merged
merged 4 commits into from
Oct 21, 2020
Merged

Conversation

ninahakansson
Copy link
Contributor

The MERSI-2 reader could no longer read angles data due to that keyword 'calibration' was always expected.

The error message:

python3.6/site-packages/satpy/readers/mersi2_l1b.py", line 95, in get_dataset
    if dataset_id['calibration'] == 'counts':
KeyError: 'calibration'
  • Tests added
  • Passes flake8 satpy

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.

Nice catch! Looks good, I just have one style comment.

@@ -92,7 +92,7 @@ def get_dataset(self, dataset_id, ds_info):

fill_value = attrs.pop('FillValue', np.nan) # covered by valid_range
valid_range = attrs.pop('valid_range', None)
if dataset_id['calibration'] == 'counts':
if 'calibration' in dataset_id and dataset_id['calibration'] == 'counts':
Copy link
Member

Choose a reason for hiding this comment

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

The more pythonic way to do this is:

Suggested change
if 'calibration' in dataset_id and dataset_id['calibration'] == 'counts':
if dataset_id.get('calibration') == 'counts':

IIRC this should work with DataIDs too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

@codecov
Copy link

codecov bot commented Oct 19, 2020

Codecov Report

Merging #1407 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1407      +/-   ##
==========================================
+ Coverage   90.56%   90.61%   +0.05%     
==========================================
  Files         228      228              
  Lines       33406    34059     +653     
==========================================
+ Hits        30254    30863     +609     
- Misses       3152     3196      +44     
Impacted Files Coverage Δ
satpy/readers/mersi2_l1b.py 96.51% <100.00%> (ø)
satpy/tests/reader_tests/test_mersi2_l1b.py 99.63% <100.00%> (+<0.01%) ⬆️
satpy/tests/test_composites.py 99.91% <0.00%> (+0.02%) ⬆️
satpy/composites/__init__.py 84.66% <0.00%> (+1.88%) ⬆️

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 12917ab...d3a473c. Read the comment docs.

@coveralls
Copy link

coveralls commented Oct 19, 2020

Coverage Status

Coverage decreased (-0.003%) to 90.562% when pulling d3a473c on ninahakansson:bugfix_mersi2_angles into 12917ab on pytroll:master.

@mraspaud mraspaud changed the title Bugfix mersi2 angles Fix mersi 2 angles reading Oct 19, 2020
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 d3450ac into pytroll:master Oct 21, 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.

3 participants