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

WALES.md example fails #117

Open
observingClouds opened this issue Oct 27, 2024 · 2 comments
Open

WALES.md example fails #117

observingClouds opened this issue Oct 27, 2024 · 2 comments
Assignees

Comments

@observingClouds
Copy link
Collaborator

Traceback (most recent call last):
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
    executenb(
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/nbclient/client.py", line 1314, in execute
    return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/jupyter_core/utils/__init__.py", line 165, in wrapped
    return loop.run_until_complete(inner)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/nbclient/client.py", line 709, in async_execute
    await self.async_execute_cell(
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/nbclient/client.py", line 1062, in async_execute_cell
    await self._check_raise_for_error(cell, cell_index, exec_reply)
  File "/usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/nbclient/client.py", line 918, in _check_raise_for_error
    raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
with plt.style.context("mplstyle/wide"):
    fig, ax = plt.subplots()

    ax.set_prop_cycle(color=plt.get_cmap("magma")(np.linspace(0, 1, 4)))
    for ind, t in enumerate([1, 5, 10]):
        averaged_cloud_fraction = min_cloud_binary_mask.resample(time=f"{t}min", loffset=f"{t/2}min").mean()
        averaged_cloud_fraction.plot(lw=ind + 1, label=f"{t} min")

    ax.set_ylim(0, 1)
    ax.set_ylabel("Cloud fraction")
    ax.set_xlabel("date: MM-DD HH")
    ax.legend(title="averaging period", bbox_to_anchor=(1,1), loc="upper left")
    None
------------------


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[9], line 6
      4 ax.set_prop_cycle(color=plt.get_cmap("magma")(np.linspace(0, 1, 4)))
      5 for ind, t in enumerate([1, 5, 10]):
----> 6     averaged_cloud_fraction = min_cloud_binary_mask.resample(time=f"{t}min", loffset=f"{t/2}min").mean()
      7     averaged_cloud_fraction.plot(lw=ind + 1, label=f"{t} min")
      9 ax.set_ylim(0, 1)

File /usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/xarray/util/deprecation_helpers.py:115, in _deprecate_positional_args.<locals>._decorator.<locals>.inner(*args, **kwargs)
    111     kwargs.update({name: arg for name, arg in zip_args})
    113     return func(*args[:-n_extra_args], **kwargs)
--> 115 return func(*args, **kwargs)

File /usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/xarray/core/dataarray.py:7384, in DataArray.resample(self, indexer, skipna, closed, label, offset, origin, restore_coord_dims, **indexer_kwargs)
   7256 """Returns a Resample object for performing resampling operations.
   7257 
   7258 Handles both downsampling and upsampling. The resampled
   (...)
   7380 .. [1] http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases
   7381 """
   7382 from xarray.core.resample import DataArrayResample
-> 7384 return self._resample(
   7385     resample_cls=DataArrayResample,
   7386     indexer=indexer,
   7387     skipna=skipna,
   7388     closed=closed,
   7389     label=label,
   7390     offset=offset,
   7391     origin=origin,
   7392     restore_coord_dims=restore_coord_dims,
   7393     **indexer_kwargs,
   7394 )

File /usr/share/miniconda3/envs/how_to_eurec4a/lib/python3.12/site-packages/xarray/core/common.py:1056, in DataWithCoords._resample(self, resample_cls, indexer, skipna, closed, label, offset, origin, restore_coord_dims, **indexer_kwargs)
   1054 indexer = either_dict_or_kwargs(indexer, indexer_kwargs, "resample")
   1055 if len(indexer) != 1:
-> 1056     raise ValueError("Resampling only supported along single dimensions.")
   1057 dim, freq = next(iter(indexer.items()))
   1059 dim_name: Hashable = dim

ValueError: Resampling only supported along single dimensions.
@observingClouds
Copy link
Collaborator Author

@tmieslinger would you mind taking a look?

@observingClouds
Copy link
Collaborator Author

The issue occurred while rerunning the build book command recently at https://github.com/eurec4a/how_to_eurec4a/actions/runs/11540381521/job/32121152521

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

2 participants