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

Metop level 2 EUMETCAST BUFR reader #1079

Merged
merged 20 commits into from Feb 25, 2020
Merged

Conversation

TalfanBarnie
Copy link
Contributor

This PR provides a reader for IASI level 2 SO2 BUFR data distributed over EUMETCAST. Flake8 is still flagging some lines > 80 characters, but these are for test data which doesn't compromise readability of the code itself.

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.

Thanks for adding this new reader to satpy! Bufr isn't an easy format :)

I have a few comments, but please run flake8 with the flake8-docstring plugin on the code.

import eccodes as ec
except ImportError:
raise ImportError(
"""Missing eccodes-python and/or eccodes C-library installation. Use conda to install eccodes""")
Copy link
Member

Choose a reason for hiding this comment

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

Just in case it's not eccodes itself missing but on of the requirements, you might want to append the original error message here.

Comment on lines 105 to 106
data_center_dict = {3: {'name': 'METOP-1'}, 4: {'name': 'METOP-2'},
5: {'name': 'METOP-3'}}
Copy link
Member

Choose a reason for hiding this comment

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

Since you only have a name here, is it necessary to make it a nested dict ?


def __init__(self, filename, filename_info, filetype_info, **kwargs):
"""Initialise the file handler for the IASI L2 SO2 BUFR data."""

Copy link
Member

Choose a reason for hiding this comment

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

No blank line after a docstring.

Comment on lines 121 to 124
self.properties = {}
self.properties['start_time'] = start_time
self.properties['end_time'] = end_time
self.properties['SpacecraftName'] = data_center_dict[sc_id]['name']
Copy link
Member

Choose a reason for hiding this comment

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

For consistency: we usually call this metadata or mda for short, not `properties.


fh.close()

return(start_time, end_time)
Copy link
Member

Choose a reason for hiding this comment

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

You don't need parenthesis here.

return(start_time, end_time)

def get_attribute(self, key):
''' Get BUFR attributes '''
Copy link
Member

Choose a reason for hiding this comment

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

Please use double quotes ("), and add a dot at then end.

SCAN_WIDTH = 120

def save_test_data(path):
"""Save the test file to the indicated directory"""
Copy link
Member

Choose a reason for hiding this comment

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

. at the end of the line.

@coveralls
Copy link

coveralls commented Feb 21, 2020

Coverage Status

Coverage increased (+0.03%) to 88.919% when pulling 95ee8b8 on TalfanBarnie:master into ca8595f on pytroll:master.

@codecov
Copy link

codecov bot commented Feb 21, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@6edfc45). Click here to learn what that means.
The diff coverage is 90.69%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1079   +/-   ##
=========================================
  Coverage          ?   88.93%           
=========================================
  Files             ?      194           
  Lines             ?    29826           
  Branches          ?        0           
=========================================
  Hits              ?    26525           
  Misses            ?     3301           
  Partials          ?        0
Impacted Files Coverage Δ
satpy/tests/reader_tests/test_iasi_l2_so2_bufr.py 96.15% <100%> (ø)
satpy/tests/reader_tests/__init__.py 98.5% <100%> (ø)
satpy/tests/reader_tests/test_nucaps.py 100% <100%> (ø)
satpy/readers/nucaps.py 89.04% <60.52%> (ø)
satpy/readers/iasi_l2_so2_bufr.py 94.44% <90.9%> (ø)

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 6edfc45...95ee8b8. Read the comment docs.

except ImportError as e:
raise ImportError(
"""Missing eccodes-python and/or eccodes C-library installation. Use conda to install eccodes.
Error: """ , e)
Copy link
Contributor

Choose a reason for hiding this comment

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

E203 whitespace before ','

@@ -42,7 +42,8 @@
test_ami_l1b, test_viirs_compact, test_seviri_l2_bufr,
test_geos_area, test_nwcsaf_msg, test_glm_l2,
test_seviri_l1b_icare, test_mimic_TPW2_nc,
test_slstr_l2, test_aapp_l1b, test_eps_l1b)
test_slstr_l2, test_aapp_l1b, test_eps_l1b,
Copy link
Contributor

Choose a reason for hiding this comment

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

W291 trailing whitespace

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.

This looks good, I just have one last request I think.

satpy/readers/iasi_l2_so2_bufr.py Show resolved Hide resolved
@mraspaud mraspaud added component:readers enhancement code enhancements, features, improvements labels Feb 24, 2020
@mraspaud
Copy link
Member

LGTM then, @djhoese do you want to have a look or can I merge ?

@mraspaud mraspaud merged commit 811a939 into pytroll:master Feb 25, 2020
@mraspaud
Copy link
Member

Merged, thanks for the contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metop level 2 EUMETCAST BUFR reader
4 participants