Skip to content

How are CDAT error/warning messages displayed ? #2243

@jypeter

Description

@jypeter

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions