Hi,
I am reading a pp file containing one dataset. The pp file was produced by some post processing of UM data in IDL. I can plot the pp field using qplt.pcolormesh but when I try and plot it with contourf I get a ValueError:The values must be numbers or instances of "nc_time_axis.CalendarDateTime". I am running on windows x64 using version 1.13 of iris.
See below for the traceback. I had a look at nc_time_axis but can't see how to convert the time-cords from floats to whatever nc_time_axis wants. So a couple of questions:
1) Is this a bug?
2) How can I convert the time to whatever nc_time_axis wants?
Simon
----------------------------
The time coords are:
a.coord('time')
Out[100]:
DimCoord(array([ 19770., 23370., 26970., 30570., 34170., 37770., 41370.,
44970., 48570., 52170., 55770., 59370., 62970.], dtype=float32), bounds=array([[ 17970., 21570.],
[ 21570., 25170.],
[ 25170., 28770.],
[ 28770., 32370.],
[ 32370., 35970.],
[ 35970., 39570.],
[ 39570., 43170.],
[ 43170., 46770.],
[ 46770., 50370.],
[ 50370., 53970.],
[ 53970., 57570.],
[ 57570., 61170.],
[ 61170., 64770.]], dtype=float32), standard_name='time', units=Unit('days since 0000-01-01 00:00:00', calendar='360_day'))
a=iris.load_cube(os.path.join(onePercent,'ot.pp'))
qplt.contourf(a)
Traceback (most recent call last):
File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2882, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-98-cb31dbf8f8c3>", line 1, in <module>
qplt.contourf(a)
File "C:\Anaconda2\lib\site-packages\iris\quickplot.py", line 187, in contourf
result = iplt.contourf(cube, *args, **kwargs)
File "C:\Anaconda2\lib\site-packages\iris\plot.py", line 803, in contourf
result = _draw_2d_from_points('contourf', None, cube, *args, **kwargs)
File "C:\Anaconda2\lib\site-packages\iris\plot.py", line 395, in _draw_2d_from_points
result = draw_method(u, v, data, *args, **kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\pyplot.py", line 2875, in contourf
ret = ax.contourf(*args, **kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\__init__.py", line 1892, in inner
return func(ax, *args, **kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\axes\_axes.py", line 5829, in contourf
contours = mcontour.QuadContourSet(self, *args, **kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\contour.py", line 864, in __init__
self._process_args(*args, **kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\contour.py", line 1429, in _process_args
x, y, z = self._contour_args(args, kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\contour.py", line 1508, in _contour_args
x, y, z = self._check_xyz(args[:3], kwargs)
File "C:\Anaconda2\lib\site-packages\matplotlib\contour.py", line 1534, in _check_xyz
x = self.ax.convert_xunits(x)
File "C:\Anaconda2\lib\site-packages\matplotlib\artist.py", line 199, in convert_xunits
return ax.xaxis.convert_units(x)
File "C:\Anaconda2\lib\site-packages\matplotlib\axis.py", line 1472, in convert_units
ret = self.converter.convert(x, self.units, self)
File "C:\Anaconda2\lib\site-packages\nc_time_axis\__init__.py", line 261, in convert
raise ValueError('The values must be numbers or instances of '
ValueError: The values must be numbers or instances of "nc_time_axis.CalendarDateTime".