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

Hysplitdev #171

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open

Hysplitdev #171

wants to merge 9 commits into from

Conversation

amcz
Copy link
Collaborator

@amcz amcz commented Apr 17, 2024

Fixes for issue #168

@@ -199,7 +207,7 @@ def __init__(

if readwrite == "r":
if verbose:
print("reading " + filename)
logger.info(f"reading {filename}")
Copy link
Member

Choose a reason for hiding this comment

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

This won't show unless user changes their logging config. Maybe such verbose=True message should stick with print().

print("WARNING in ModelBin _readfile - number of starting locations " "incorrect")
print(hdata1["start_loc"])
logger.warning(
f"WARNING in ModelBin {self.filename} _readfile - number of starting locations incorrect"
Copy link
Member

Choose a reason for hiding this comment

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

If this is a message intended for the user, suggest using warnings.warn() instead of the logger. In either case, the word "warning" doesn't need to be included in the message since that should already be clear.

Copy link
Member

@zmoon zmoon left a comment

Choose a reason for hiding this comment

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

Regarding the switch to using a logger for certain messages: for messages intended for a normal user using the module to load HYSPLIT output, I would suggest using print() or warnings.warn(). The latter may be preferred for situations where there's something the user could change to avoid the warning, e.g. by fixing something wrong with their data or by changing how they are using your code. logger.info() or logger.debug() can be helpful for messages that may aid in your debugging of the module or helping a user debug but are not needed in normal vebrose or non-verbose usage.

@@ -368,7 +380,7 @@ def parse_hdata2(self, hdata2, nstartloc, century):
century = 2000
else:
century = 1900
print("WARNING: Guessing Century for HYSPLIT concentration file", century)
logger.info(f"WARNING: Guessing Century for HYSPLIT concentration file {century}")
Copy link
Member

Choose a reason for hiding this comment

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

Suggest using warnings.warn()

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