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

Weather Forecast Retrieval - Update to v0.7 #206

Merged
merged 1 commit into from
Apr 27, 2021
Merged

Weather Forecast Retrieval - Update to v0.7 #206

merged 1 commit into from
Apr 27, 2021

Conversation

jomey
Copy link
Collaborator

@jomey jomey commented Apr 27, 2021

Adapt the changes introduced in weather_forecast_retrieval v0.7.

Adapt the changes introduced in weather_forecast_retrieval v0.7.
@jomey jomey requested a review from scotthavens April 27, 2021 20:21
@@ -1,6 +1,6 @@
import numpy as np
import pandas as pd
from weather_forecast_retrieval.hrrr import HRRR
import weather_forecast_retrieval.data.hrrr as hrrr_data
Copy link
Contributor

Choose a reason for hiding this comment

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

Why rename it? Could you not just import FileLoader or just do hrrr.FileLoader?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you look at the call in line 58 and the import with reanming, this clearly indicates where the FileLoader is coming from. It basically combines the hrrr.data as hrrr_data. Using only hrrr is a very general name, has higher potential to be accidentally overwritten by a local variable, and using hrrr_data then also shows why and what this import does. Not importing the FileLoader also indicates in the lower line that this class is not part of SMRF and rather an imported class from WFR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It follows the principle found for instance in the Google Python style guide, with the addition of renaming to prevent the above mentioned potential of error
https://google.github.io/styleguide/pyguide.html#224-decision

Copy link
Contributor

Choose a reason for hiding this comment

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

I understand why to rename it, I'm just not a fan as it seems to add an extra layer to the import. To me, this is then an bad name in WFR and should have been named something else to avoid someone using a duplicate variable name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not agree with calling this a bad name choice in WFR. Naming conventions should not only be driven on how other libraries would use it and also reflect the structure of the library itself. From that regard, the naming was a natural hierarchy to me.

Happy to remove this alias and use only hrrr. Then it is identical to the import as it was before. The alias was a conservative strategy based of observations in the current code base where variable names did not have a consistent descriptive choice.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it was a bad name choice either, it is the natural choice.

I think I'm more of a purist in this regard of not renaming packages, it's just a personal preference. I do see the benefit when they have a common name to rename the module. As SMRF/AWSM get to be more verbose, then this shouldn't be an issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thought about some possible options to establish a common style used across the different libraries.
What do you think of this kind of import style:

import weather_forecast_retrieval as wfr

Then the call becomes:

wfr.data.hrrr.FileLoader

This convention leans on the numpy or matplotlib style, where there is a common acronym for both.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like that, especially for WRF, it's such a long repo name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will update with a next PR

@scotthavens scotthavens merged commit ac97908 into master Apr 27, 2021
@scotthavens scotthavens deleted the WFR_0.7 branch April 27, 2021 21:05
@scotthavens
Copy link
Contributor

Travis CI is off and forced the merge. This will be tested in the next PR where the Github actions are being setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants