-
Notifications
You must be signed in to change notification settings - Fork 29
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
base: develop
Are you sure you want to change the base?
Hysplitdev #171
Conversation
…ake sure that the level heights attribute is a list and not an numpy array. The numpy array attributes don't write/read well from a netcdf file.
…ed to use a helper class. update also allows the cdump files to be skipped over if they are empty.
@@ -199,7 +207,7 @@ def __init__( | |||
|
|||
if readwrite == "r": | |||
if verbose: | |||
print("reading " + filename) | |||
logger.info(f"reading {filename}") |
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.
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" |
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.
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.
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.
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}") |
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.
Suggest using warnings.warn()
Fixes for issue #168