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

Alphabetize available_readers method and update documentation #1378

Merged
merged 4 commits into from Oct 1, 2020

Conversation

alishahusain
Copy link
Contributor

@alishahusain alishahusain commented Sep 23, 2020

Alphabetized the list of readers returned by the available_readers() method. Updated documentation so users know they can also do as_dict=True to return more information.

  • Passes flake8 satpy
  • Fully documented

@coveralls
Copy link

coveralls commented Sep 23, 2020

Coverage Status

Coverage increased (+0.04%) to 90.565% when pulling 0f0b3d4 on alishahusain:alphabetize-readers into 1612d84 on pytroll:master.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

Nice job. I like the additon in the readers.rst file and the sorting looks good to me. Looks like a couple unrelated things were changed that I've commented on inline below. If you could revert those changes or explain why you made them then I'd be happy to merge this.

In case you weren't aware, on github to update a pull request you can just push more commits to the same branch and github will update the PR automatically.

To get a list of available readers use the `available_readers` function::
To get a list of available readers use the `available_readers` function. By default,
it returns the names of available readers. To return additional reader information
use `available_readers(as_dict=True)`::
Copy link
Member

Choose a reason for hiding this comment

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

Nice! Great addition.

@@ -315,10 +312,13 @@ def available_readers(as_dict=False):
try:
reader_info = read_reader_config(reader_configs)
except (KeyError, IOError, yaml.YAMLError):
LOG.warning("Could not import reader config from: %s", reader_configs)
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain why you removed this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The person who made the original request recommended that we "suppress [the output] when the reader config is not found as a first time user this creates a lot of clutter."

Copy link
Member

Choose a reason for hiding this comment

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

Good thinking! Could you just make it a debug instead? That way, regular users won't see it but devs will still get the info.


Given a mapping where each key is a reader name and each value is a
"""From a mapping from _assign_files_to_readers, get file keys."""
"""Given a mapping where each key is a reader name and each value is a
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what happened with these docstrings, but could you revert these changes (this one and the two above)? I've never seen this formatting for docstrings but I know the docstrings were formatted properly already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, the only reason I changed this is because the pre-commit hook kept flagging these lines with "no blank lines allowed after function docstring"

Copy link
Member

Choose a reason for hiding this comment

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

This means that you are not allowed to have any blank lines between the docstring's last """ and the code iiuc

@mraspaud mraspaud changed the title alphebetized available_readers method and updated documentation Alphabetize available_readers method and updated documentation Sep 23, 2020
@mraspaud mraspaud changed the title Alphabetize available_readers method and updated documentation Alphabetize available_readers method and update documentation Sep 23, 2020
@codecov
Copy link

codecov bot commented Sep 23, 2020

Codecov Report

Merging #1378 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1378      +/-   ##
==========================================
+ Coverage   90.52%   90.56%   +0.03%     
==========================================
  Files         228      228              
  Lines       33377    33406      +29     
==========================================
+ Hits        30215    30254      +39     
+ Misses       3162     3152      -10     
Impacted Files Coverage Δ
satpy/readers/__init__.py 96.96% <100.00%> (+0.04%) ⬆️
satpy/tests/test_readers.py 99.04% <100.00%> (+<0.01%) ⬆️
satpy/tests/writer_tests/test_mitiff.py 99.16% <0.00%> (+0.05%) ⬆️
satpy/tests/reader_tests/test_vii_base_nc.py 98.73% <0.00%> (+1.26%) ⬆️
satpy/tests/reader_tests/test_nwcsaf_msg.py 98.31% <0.00%> (+1.68%) ⬆️
satpy/tests/reader_tests/test_vii_l1b_nc.py 100.00% <0.00%> (+2.81%) ⬆️
satpy/tests/reader_tests/test_viirs_compact.py 100.00% <0.00%> (+4.16%) ⬆️
satpy/tests/reader_tests/test_vii_l2_nc.py 100.00% <0.00%> (+6.06%) ⬆️

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 1612d84...0f0b3d4. Read the comment docs.

@mraspaud
Copy link
Member

Looks great so far! We just need to test the new behaviour now.

@mraspaud
Copy link
Member

@alishahusain do you have time to fix a unit test for this?

@alishahusain
Copy link
Contributor Author

@alishahusain do you have time to fix a unit test for this?

Yes, I will send an updated pull request shortly.

@djhoese
Copy link
Member

djhoese commented Sep 29, 2020

Keep in mind you only need to push new commits to this same branch and github will update the pull request. No need to create a new PR.

@ghost
Copy link

ghost commented Sep 29, 2020

Congratulations 🎉. DeepCode analyzed your code in 3.593 seconds and we found no issues. Enjoy a moment of no bugs ☀️.

👉 View analysis in DeepCode’s Dashboard | Configure the bot

@@ -625,12 +625,16 @@ def test_available_readers(self):
self.assertIsInstance(reader_names[0], str)
self.assertIn('viirs_sdr', reader_names) # needs h5py
self.assertIn('abi_l1b', reader_names) # needs netcdf4
for i in range(1, len(reader_names)):
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about self.assertEqual(reader_names, sorted(reader_names))?

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.

LGTM, thanks for working on the reader name sorting

@mraspaud
Copy link
Member

mraspaud commented Oct 1, 2020

Closes #1343

@mraspaud mraspaud merged commit 40fb438 into pytroll:master Oct 1, 2020
@mraspaud mraspaud added component:readers enhancement code enhancements, features, improvements labels Oct 23, 2020
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.

None yet

4 participants