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

How are CDAT error/warning messages displayed ? #2243

Open
jypeter opened this issue Aug 30, 2019 · 1 comment
Open

How are CDAT error/warning messages displayed ? #2243

jypeter opened this issue Aug 30, 2019 · 1 comment

Comments

@jypeter
Copy link
Member

jypeter commented Aug 30, 2019

I'm just wondering if there is kind of a defined standard for displaying CDAT (packages) error/warning messages ? The trouble with python is that when you run a (long) script that may have its own verbose output, and you get Warnings from python (e.g. deprecation warnings), and possibly a long traceback at the end, you want the really important/interesting warnings from CDAT to stand out

This may seem old fashioned and may break some python philosophical way of doing things, but I like to print my error message with a blank line before and after, and * (or **, which makes it possible to look for (or grep) ** in the output to locate errors) in the first column, e.g.

**
** Some error occured
** Some details AND recommendations for fixing the error
**

Anyway, something that looks sufficiently different from

/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/numpy/ma/core.py:3174: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  dout = self.data[indx]

is more readable and stands out more than

Traceback (most recent call last):
  File "prepare_plio_data.py", line 42, in <module>
    cdutil.setTimeBoundsMonthly(v_CM6_0k)
  File "/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/cdutil-8.0-py3.7.egg/cdutil/times.py", line 1231, in setTimeBoundsMonthly
  File "/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/cdutil-8.0-py3.7.egg/cdutil/times.py", line 1215, in setSlabTimeBoundsMonthly
  File "/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/cdutil-8.0-py3.7.egg/cdutil/times.py", line 1183, in setAxisTimeBoundsMonthly
  File "/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/cdms2/axis.py", line 951, in asComponentTime
    result.append(cdtime.reltime(val, self.units).tocomp(calendar))
  File "/home/share/unix_files/cdat/miniconda3/envs/cdatm_py2/lib/python2.7/site-packages/cdtime/compreltime.py", line 254, in reltime
    return _cdtime.reltime(value, units)
ValueError: Invalid relative time units
@doutriaux1
Copy link
Contributor

You have point, although here the comparison is not fair, you're comparing a warning (something intended by the developer) versus an error generated by the user "bad" data.

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

No branches or pull requests

2 participants