-
Notifications
You must be signed in to change notification settings - Fork 295
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
Add reader for OSI SAF L3 products #2632
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #2632 +/- ##
========================================
Coverage 95.21% 95.21%
========================================
Files 356 358 +2
Lines 51605 51956 +351
========================================
+ Hits 49134 49471 +337
- Misses 2471 2485 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Pull Request Test Coverage Report for Build 7020440556
💛 - Coveralls |
return self["/attr/platform_name"] | ||
except KeyError: | ||
return self["/attr/platform"] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think I inadvertently fixed this while sorting out another suggestion.
satpy/readers/osisaf_l3_nc.py
Outdated
def _get_ds_attr(self, a_name): | ||
"""Get a dataset attribute and check it's valid.""" | ||
try: | ||
return self[a_name] | ||
except KeyError: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the same thing:
satpy/satpy/readers/netcdf_utils.py
Lines 346 to 351 in 6fb1d1e
def get(self, item, default=None): | |
"""Get item.""" | |
if item in self: | |
return self[item] | |
else: | |
return default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, apparently yes! Removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some minor comments.
It can't read the files we get from EUMETCAST, which have the format S-OSI_-DMI_-MULT-GL_NH_CONCn__-202304251200Z.nc
. But then again, nor can we (our internal reader gives us an HDF error since a while).
satpy/readers/osisaf_l3_nc.py
Outdated
try: | ||
return self[a_name] | ||
except KeyError: | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why swallow the KeyError
s? Wouldn't that hide bugs elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because various versions of the files have different key names, so I have to try multiple attempts. Some of them don't have the attr at all - hence hiding the error. Would you prefer if I added a log warning or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the main way this is used is to try multiple possible attribute/variable names, then maybe a different version of this with a for loop would be better?
attr_val = self._get_first_attr(("/attr/X", "/attr/Y", "/attr/Z"))
def _get_first_attr(self, possible_names):
for attr_name in possible_names:
try:
return self[attr_name]
except KeyError:
continue
raise KeyError("...")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully my newest change is suitable. If not, I'll come back to it some time in the new year.
I think I've addressed all your comments, thanks for the reviews! |
Thanks! It works with the files we get on EUMETCAST now. |
[x] Closes #1955 (does that work automatically in a comment?) |
This PR adds a reader for the OSI SAD level 3 products on an EASE or polar stereographic grid in netCDF format. It's been tested with the following products:
Ice concentration
Ice type
Ice edge
Ice emissivity
Tests added