-
Notifications
You must be signed in to change notification settings - Fork 303
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 MWS onboard EPS-SG-A #2120
Conversation
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Codecov Report
@@ Coverage Diff @@
## main #2120 +/- ##
==========================================
+ Coverage 94.03% 94.14% +0.10%
==========================================
Files 289 293 +4
Lines 44564 45091 +527
==========================================
+ Hits 41904 42449 +545
+ Misses 2660 2642 -18
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I have a hard time deciding how the channel/band inter-comparison should behave here! :-| |
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Here, a quick example usage:
It is also possible to load the data simply by specifying the channel number, like: |
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
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.
Lots of new content in a part of Satpy I'm not too familiar with, so do with my questions and remarks what you wish. There seems to be some code duplication, though.
return False | ||
|
||
def distance(self, value): | ||
"""Get the distance from value.""" |
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.
Here too could be some info on how this distance is defined.
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.
Added more explanation.
def __lt__(self, other): | ||
"""Compare to another frequency.""" | ||
if other is None: | ||
return False | ||
return super().__lt__(other) | ||
|
||
def __gt__(self, other): | ||
"""Compare to another frequency.""" | ||
if other is None: | ||
return True | ||
return super().__gt__(other) | ||
|
||
def __hash__(self): | ||
"""Hash this tuple.""" | ||
return tuple.__hash__(self) |
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.
Seems to repeat lines 94–108. Could this be refactored out?
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.
That is correct. I also discussed with @mraspaud that one could probably define the quadruple side band from the double side band, and then use inheritance to get rid of this redundancy. However, I am not sure we will ever find use with all the arithmetics on these bands. For instance I have chosen not to try to be too smart when calculating distances etc between them. Thus I would rather leave such refactoring till we really see a need for this.
I also don't have much time/resources for now to elaborate much further on this.
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.
I think the refactoring can still be done using a mixin class though, even if the link between double- and quadrupleband isn't implemented.
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.
Good point! I did this just now.
# Conflicts: # doc/source/index.rst
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…alue Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ency types Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
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.
Still some comments, sorry...
MWS_CHANNEL_NAMES_TO_NUMBER = {'1': 1, '2': 2, '3': 3, '4': 4, | ||
'5': 5, '6': 6, '7': 7, '8': 8, | ||
'9': 9, '10': 10, '11': 11, '12': 12, | ||
'13': 13, '14': 14, '15': 15, '16': 16, | ||
'17': 17, '18': 18, '19': 19, '20': 20, | ||
'21': 21, '22': 22, '23': 23, '24': 24} |
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.
wouldn't be simpler to do int(channel_name)
than using a dict like this?
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.
I was not sure this would actually be the final channel/band naming in the file
if 'scale_factor' in variable.attrs and 'add_offset' in variable.attrs: | ||
missing_value = variable.attrs['missing_value'] | ||
variable.data = da.where(variable.data == missing_value, np.nan, |
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.
Is this tested?
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.
Probably not. I think this code should never be used as all datasets will have a scale and ofsset in the netCDF file
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.
Forget what I said above! The code is now tested, thx!
left_side_dist = abs(value.central - value.side - value.sideside - left_left) | ||
right_side_dist = abs(value.central + value.side + value.sideside - right_right) | ||
except AttributeError: | ||
if isinstance(value, (tuple, list)): | ||
msg = 'Distance to a quadruple side band frequency not supported for this type' | ||
raise NotImplementedError(msg) |
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.
Is this tested?
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.
You got me! Right, it wasn't. It is now. But the NotImplementedError
would never happen as it is implemented right now. So, I removed the check for tuple/list.
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Simplify - reuse already created list Co-authored-by: Martin Raspaud <martin.raspaud@smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…tpy into add-epssg-mws-level1b-reader
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.
LGTM. Regarding the title, is this still a first draft?
I changed the title. It is adding a reader. Then as this has been developed on test data and we cannot start testing and use it in real applications I suppose there might be things we would like to change and improve. But we don't know yet. |
This is a first draft reader for the EPS-SG MWS level-1b netCDF file format.
AUTHORS.md
if not there alreadyThis is an early draft so far, and several things needs to be addressed:
FrquencyRange
and related classes defined in the AAPP-MHS reader so they can be reused in several readers