Skip to content

MPAS+JEDI pythia cookbook zonal average plot crash #1543

Description

@Sevans711

Version

v2026.6.1

How did you install UXarray?

Source

What happened?

The zonal average plot for the MPAS+JEDI pythia cookbook currently crashes with ValueError (and subsequent cell's plot also does not display): https://projectpythia.org/mpas-jedi-cookbook/notebooks/mpas-advanced/#zonal-average

The error looks like:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[21], line 12
      8         height=250, width=500,
      9         colorbar=True,colorbar_position='left'
     10             )* coast_lines * state_lines
     11 
---> 12     + zonal_mean_uxvar.plot.line(
     13         x="theta_zonal_mean",y="latitudes",
     14         height=250,width=150,
     15         ylabel="",

File ~/micromamba/envs/mpas-jedi-cookbook-dev/lib/python3.11/site-packages/xarray/plot/accessor.py:136, in DataArrayPlotAccessor.line(self, *args, **kwargs)
    134 @functools.wraps(dataarray_plot.line, assigned=("__doc__",))
    135 def line(self, *args, **kwargs) -> list[Line3D] | FacetGrid[DataArray]:
--> 136     return dataarray_plot.line(self._da, *args, **kwargs)

File ~/micromamba/envs/mpas-jedi-cookbook-dev/lib/python3.11/site-packages/xarray/plot/dataarray_plot.py:509, in line(darray, row, col, figsize, aspect, size, ax, hue, x, y, xincrease, yincrease, xscale, yscale, xticks, yticks, xlim, ylim, add_legend, _labels, *args, **kwargs)
    506     assert "args" not in kwargs
    508 ax = get_axis(figsize, size, aspect, ax)
--> 509 xplt, yplt, hueplt, hue_label = _infer_line_data(darray, x, y, hue)
    511 # Remove pd.Intervals if contained in xplt.values and/or yplt.values.
    512 xplt_val, yplt_val, x_suffix, y_suffix, kwargs = _resolve_intervals_1dplot(
    513     xplt.to_numpy(), yplt.to_numpy(), kwargs
    514 )

File ~/micromamba/envs/mpas-jedi-cookbook-dev/lib/python3.11/site-packages/xarray/plot/dataarray_plot.py:70, in _infer_line_data(darray, x, y, hue)
     67 ndims = len(darray.dims)
     69 if x is not None and y is not None:
---> 70     raise ValueError("Cannot specify both x and y kwargs for line plots.")
     72 if x is not None:
     73     _assert_valid_xy(darray, x, "x")

ValueError: Cannot specify both x and y kwargs for line plots.

What did you expect to happen?

I expected a nice plot, not a crash.

Can you provide a MCVE to repoduce the bug?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
📚 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions