Skip to content

W2D3T8 has plotting errors on Google Colab #149

@jlpearso

Description

@jlpearso

In section 1.1, when plotting the probability density functions, the return levels, and assessing the fit using the QQ plot from previous tutorials, this error pops up. It seems to be an issue for later, similar plots as well.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
[<ipython-input-20-f5ecc5a2df9e>](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in <cell line: 0>()
     28 
     29 # create time data array for PDF comparison (bottom left)
---> 30 x = np.linspace(wetbulb_hist_delhi.min() - 1, wetbulb_hist_delhi.max() + 1, 1000)
     31 wetbulb_hist_delhi.plot.hist(
     32     bins=np.arange(29, 33, 0.25),

5 frames
[/usr/local/lib/python3.11/dist-packages/numpy/_core/function_base.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in linspace(start, stop, num, endpoint, retstep, dtype, axis, device)
    187         _nx.floor(y, out=y)
    188 
--> 189     y = conv.wrap(y.astype(dtype, copy=False))
    190     if retstep:
    191         return y, step

[/usr/local/lib/python3.11/site-packages/xarray/core/dataarray.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in __array_wrap__(self, obj, context, return_scalar)
   4806 
   4807     def __array_wrap__(self, obj, context=None, return_scalar=False) -> Self:
-> 4808         new_var = self.variable.__array_wrap__(obj, context, return_scalar)
   4809         return self._replace(new_var)
   4810 

[/usr/local/lib/python3.11/site-packages/xarray/core/variable.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in __array_wrap__(self, obj, context, return_scalar)
   2314 
   2315     def __array_wrap__(self, obj, context=None, return_scalar=False):
-> 2316         return Variable(self.dims, obj)
   2317 
   2318     def _unary_op(self, f, *args, **kwargs):

[/usr/local/lib/python3.11/site-packages/xarray/core/variable.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in __init__(self, dims, data, attrs, encoding, fastpath)
    363             unrecognized encoding items.
    364         """
--> 365         super().__init__(
    366             dims=dims, data=as_compatible_data(data, fastpath=fastpath), attrs=attrs
    367         )

[/usr/local/lib/python3.11/site-packages/xarray/namedarray/core.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in __init__(self, dims, data, attrs)
    262     ):
    263         self._data = data
--> 264         self._dims = self._parse_dimensions(dims)
    265         self._attrs = dict(attrs) if attrs else None
    266 

[/usr/local/lib/python3.11/site-packages/xarray/namedarray/core.py](https://rtufvq28a8k-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20250523-060037_RC00_762368262#) in _parse_dimensions(self, dims)
    506         dims = (dims,) if isinstance(dims, str) else tuple(dims)
    507         if len(dims) != self.ndim:
--> 508             raise ValueError(
    509                 f"dimensions {dims} must have the same length as the "
    510                 f"number of data dimensions, ndim={self.ndim}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions