Skip to content

examples/xarray_multidimensional_coords.ipynb broken? #2580

@cdeil

Description

@cdeil

I tried running examples/xarray_multidimensional_coords.ipynb and found a few issues.

First xarray.version didn't exist, so I changed to xr.__version_.

Next I changed to ds = xr.tutorial.open_dataset('rasm').load() to get rid of a deprecation warning.

Finally, the plot example failed like this:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-23-b7284116c837> in <module>
      2 ax = plt.axes(projection=ccrs.PlateCarree())
      3 ax.set_global()
----> 4 ds.Tair[0].plot.pcolormesh(ax=ax, transform=ccrs.PlateCarree(), x='xc', y='yc', add_colorbar=False)
      5 ax.coastlines()
      6 ax.set_ylim([0,90]);

~/software/anaconda3/envs/multinorm/lib/python3.7/site-packages/xarray/plot/plot.py in plotmethod(_PlotMethods_obj, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, colors, center, robust, extend, levels, infer_intervals, subplot_kws, cbar_ax, cbar_kwargs, xscale, yscale, xticks, yticks, xlim, ylim, norm, **kwargs)
    917         for arg in ['_PlotMethods_obj', 'newplotfunc', 'kwargs']:
    918             del allargs[arg]
--> 919         return newplotfunc(**allargs)
    920 
    921     # Add to class _PlotMethods

~/software/anaconda3/envs/multinorm/lib/python3.7/site-packages/xarray/plot/plot.py in newplotfunc(darray, x, y, figsize, size, aspect, ax, row, col, col_wrap, xincrease, yincrease, add_colorbar, add_labels, vmin, vmax, cmap, center, robust, extend, levels, infer_intervals, colors, subplot_kws, cbar_ax, cbar_kwargs, xscale, yscale, xticks, yticks, xlim, ylim, norm, **kwargs)
    854                              vmax=cmap_params['vmax'],
    855                              norm=cmap_params['norm'],
--> 856                              **kwargs)
    857 
    858         # Label the plot with metadata

~/software/anaconda3/envs/multinorm/lib/python3.7/site-packages/xarray/plot/plot.py in pcolormesh(x, y, z, ax, infer_intervals, **kwargs)
   1108             y = _infer_interval_breaks(y, axis=0)
   1109 
-> 1110     primitive = ax.pcolormesh(x, y, z, **kwargs)
   1111 
   1112     # by default, pcolormesh picks "round" values for bounds

~/software/anaconda3/envs/multinorm/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py in pcolormesh(self, *args, **kwargs)
   1449                              ' consider using PlateCarree/RotatedPole.')
   1450         kwargs.setdefault('transform', t)
-> 1451         result = self._pcolormesh_patched(*args, **kwargs)
   1452         self.autoscale_view()
   1453         return result

~/software/anaconda3/envs/multinorm/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py in _pcolormesh_patched(self, *args, **kwargs)
   1467         import matplotlib.collections as mcoll
   1468 
-> 1469         if not self._hold:
   1470             self.cla()
   1471 

AttributeError: 'GeoAxesSubplot' object has no attribute '_hold'

It seems examples/xarray_multidimensional_coords.ipynb is broken?
Maybe you could add a CI build to make sure it executes OK?

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None

xarray: 0.11.0
pandas: 0.23.4
numpy: 1.15.4
scipy: 1.1.0
netCDF4: 1.4.2
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.2.1
PseudonetCDF: None
rasterio: None
iris: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.20.2
distributed: 1.24.2
matplotlib: 3.0.0
cartopy: 0.16.0
seaborn: None
setuptools: 40.4.3
pip: 18.1
conda: None
pytest: 3.8.2
IPython: 7.0.1
sphinx: 1.8.1

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