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 nucaps reader failing when kwargs are passed #1303
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1303 +/- ##
=======================================
Coverage 90.01% 90.01%
=======================================
Files 220 220
Lines 32244 32258 +14
=======================================
+ Hits 29025 29038 +13
- Misses 3219 3220 +1
Continue to review full report at Codecov.
|
Are you saying p2g is passing the mask flags to the file handlers? |
No, sorry, let me clarify. Polar2Grid is passing |
OK, then I don't get how mask_* is passed to the file handlers, since the super init is called without them. |
Anyway, the right to have it would be to suppress the kwargs at the reader level I think |
It is outside the yaml_reader.py actually and this is functionality that I was concerned about when it was added. People wanted to be able to pass kwargs to file handlers where I had previously limited it to the reader class only. Here is where the kwargs are passed to file handlers: https://github.com/pytroll/satpy/blob/master/satpy/readers/__init__.py#L767 Keep in mind though that the user shouldn't need to know what is a reader kwarg and what is a file handler kwarg. I suppose yaml reader could be updated to support this kind of thing but it gets a little iffy with it knowing what kwargs are what. |
OK, I understand. Indeed this is not optimal, but the ability to pass kwargs to the file handlers is good I think. As you say though, a user shouldn't have to know which class is consuming the kwargs. Ideally, the reader would pop out the kwargs it's consuming from the list, and leave the rest untouched, to be passed on to the file handlers, eg through a property of the reader. |
Agreed, but in the current implementation the Reader instance is out of the loop for what kwargs go to file handlers. Best case would be to override the |
Polar2Grid can't use the nucaps reader with semi-recent versions of Satpy because it always passes the mask_surface and mask_quality flags to the readers and the file handler blindly passed them on to its base classes. Instead, these were supposed to be provided to the reader and ignored by the file handler.
I think this is a good example of how the tests are maybe a little too low-level and should be using higher level interfaces for testing (creating readers).
flake8 satpy