Skip to content

Error plotting empty timeseries #27

@duncanwp

Description

@duncanwp

When plotting a time-series with all the data-points masked matplotlib throws an error about the date conversion:

...
  File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/cis/plotting/plot.py", line 126, in format_datetime
    date_time = num2date(x)
  File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/matplotlib/dates.py", line 522, in num2date
    return _from_ordinalf(x, tz)
  File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/matplotlib/dates.py", line 321, in _from_ordinalf
    'expects datetime objects.'.format(ix))
ValueError: Cannot convert -1 to a date.  This often happens if non-datetime values are passed to an axis that expects datetime objects.

CIS should catch this and produce an informative error when trying to plot empty datasets.

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