-
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
Fix osisaf SST reader #1410
Fix osisaf SST reader #1410
Conversation
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
I have two yaml files, one for OSISAF ( |
iirc you can add a |
Ok, thanks @mraspaud
? |
no I mean in the filehandler python code |
…th SLSTR and OSISAF Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
DeepCode's analysis on #1d2e85 found:
Top issues
👉 View analysis in DeepCode’s Dashboard | Configure the bot |
I see what you mean @mraspaud |
# Conflicts: # satpy/etc/readers/slstr_l2.yaml # satpy/readers/ghrsst_l2.py Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Color legend originally provided by MET Norway and the OSISAF
This code now produce the image below:
Using the enhancement here:
It is supposed to look as similar as possible to the imagery we currently produce at SMHI with mpop. The corresponding image and its diff is added below: |
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
I have added a PR (#2075) documenting how the use of a colorize enhancement as above can be done. So I am ready to remove the part in the |
Got an answer from our colleagues in the OSISAF. There is yet no standard/official OSISAF color scale to refer to, so I suggest we remove it from the |
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.
Thanks for this PR, looks promising. Some inline comments.
Follow Python 3 standard for class inherritance Co-authored-by: Martin Raspaud <martin.raspaud@smhi.se>
… reading Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Codecov Report
@@ Coverage Diff @@
## main #1410 +/- ##
==========================================
+ Coverage 93.86% 93.89% +0.02%
==========================================
Files 283 283
Lines 42379 42583 +204
==========================================
+ Hits 39781 39985 +204
Misses 2598 2598
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
… object instead 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.
Nice work! Just a couple questions about readability.
satpy/readers/ghrsst_l2.py
Outdated
with tempfile.TemporaryDirectory() as tempdir: | ||
with tarfile.open(name=filename, mode='r') as tf: | ||
sst_filename = next((name for name in tf.getnames() | ||
if name.endswith('nc') and 'GHRSST-SSTskin' in name)) | ||
if name.endswith('nc') and 'GHRSST-SSTskin' in name)) |
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 could move the if condition to a separate method, _is_sst_file
for instance
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 suggestion, I will fix
mocked_dataset.assert_called() | ||
mocked_dataset.reset_mock() | ||
|
||
with patch('tarfile.open') as tf: |
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.
Instead of mocking, would it be possible to write such a tarfile during test setup?
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.
Yes, I think this is a good idea. I will come back with a proposal
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.
LGTM, thanks for refactoring the tests! Just two tiny comments
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>
@mraspaud Are my updates satisfactory do you think? |
yes, it look good now, but the tests are failing on windows, because of the classical permission error. However, as we are moving to pytest more now, I would suggest to transition the tests to pytest here too, and use the |
In an attempt to make the tests pass on Windows Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Okay, so now the tests pass! There is a 0.02% decrease in test coverage. But the Coveralls page is not very friendly - don't see where this decrease sits? |
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, much nicer with pytest!
Adding support for reading OSISAF GHRSST formattet SST data.
There was some code to read the OSISAF SST but wasn't really finished. Further the SLSTR-L2 reader was actually a GHRSST reader, and both OSISAF and SLSTR-L2 follow the GHRSST format standard. So we can make use of the same code.
satpy/etc/readers/ghrsst_l3c_sst.yaml
has been removed and replaced byghrsst_l2.yaml
slstr_l2.py
has been replaced byghrsst_l2.py
, which is only a slightly modified/enhanced compared toslstr_l2.py
test_slstr_l2.py
totest_ghrsst_l2.py
generic.yaml
to display the SST using a colormap - I suppose we should remove that and instead suggest how to do this via the documentation or thepytroll-examples
?flake8 satpy