eurec4a / how_to_eurec4a

Code examples to get you started with EUREC⁴A data.
https://howto.eurec4a.eu
MIT License
6 stars 20 forks source link

WALES.md example fails #117

Open observingClouds opened 1 month ago

observingClouds commented 1 month ago
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 commented 1 month ago

@tmieslinger would you mind taking a look?

observingClouds commented 1 month ago

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