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

examples/xarray_multidimensional_coords.ipynb broken? #2580

Closed
cdeil opened this issue Nov 28, 2018 · 4 comments
Closed

examples/xarray_multidimensional_coords.ipynb broken? #2580

cdeil opened this issue Nov 28, 2018 · 4 comments

Comments

@cdeil
Copy link
Contributor

cdeil commented Nov 28, 2018

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

@rabernat
Copy link
Contributor

This error is a matplotlib / cartopy compatibility issue. It can be fixed by upgrading matplotlib to version 3.0.2 (latest release) or upgrading cartopy to 0.17.0, or both.

@cdeil
Copy link
Contributor Author

cdeil commented Nov 28, 2018

But the xr.version.version from cell 1 gives an error on master and the latest release, the notebook won't run as-is, no?

@dcherian dcherian mentioned this issue Nov 28, 2018
1 task
@dcherian
Copy link
Contributor

Thanks @cdeil See #2581

@cdeil
Copy link
Contributor Author

cdeil commented Nov 29, 2018

@dcherian - Thank you!

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

3 participants