Fix notebook `intermediate/indexing/why-an-index.ipynb`
還沒有人認領這個 Issue。
評估
研究方向
開啟 intermediate/indexing/why-an-index.ipynb 並從頭到尾執行,重點關注 Cell In[16],其中 periodic.sel(angle=q) 會產生包含單一元素的 angle 維度。檢查陣列輸入的索引行為並更新 notebook,使繪製的值與 q 的 721 個元素相符;在未出現所回報的維度錯誤的情況下重新執行完整 notebook 即完成此項工作。
由索引模型根據 Issue 內容生成。
描述
This notebook (looking at 54df4e2fc01e51905210793f7aa01df0d87be86b ) doesn't run top to bottom
Cell In[16], [line 7](vscode-notebook-cell:?execution_count=16&line=7)
3 periodic_temp = periodic.sel(angle=q)
4
5 fig, ax = plt.subplots(figsize=(9, 4))
6 ax.scatter(sensor_fold, metal_ring.values, color="0.3", s=45, zorder=5, label="the sensors")
----> [7](vscode-notebook-cell:?execution_count=16&line=7) ax.plot(q, periodic_temp, color="tab:green", lw=2.5, label="PeriodicIndex .sel")
8 ax.plot(q, default_temp, color="tab:red", lw=2, label="default index")
9 ax.axvline(0, color="0.6", ls=":", lw=1)
10 ax.set_xlabel("query angle (°)")
File ~/coding/repos/xarray-tutorial/.pixi/envs/default/lib/python3.14/site-packages/matplotlib/axes/_axes.py:1792, in Axes.plot(self, scalex, scaley, data, *args, **kwargs)
1549 """
1550 Plot y versus x as lines and/or markers.
1551
(...) 1789 (``'green'``) or hex strings (``'#008000'``).
1790 """
1791 kwargs = cbook.normalize_kwargs(kwargs, mlines.Line2D)
-> [1792](https://file+.vscode-resource.vscode-cdn.net/Users/Hodgs004/coding/repos/xarray-tutorial/intermediate/indexing/~/coding/repos/xarray-tutorial/.pixi/envs/default/lib/python3.14/site-packages/matplotlib/axes/_axes.py:1792) lines = [*self._get_lines(self, *args, data=data, **kwargs)]
1793 for line in lines:
1794 self.add_line(line)
File ~/coding/repos/xarray-tutorial/.pixi/envs/default/lib/python3.14/site-packages/matplotlib/axes/_base.py:331, in _process_plot_var_args.__call__(self, axes, data, return_kwargs, *args, **kwargs)
329 this += args[0],
...
511 if x.ndim > 2 or y.ndim > 2:
512 raise ValueError(f"x and y can be no greater than 2D, but have "
513 f"shapes {x.shape} and {y.shape}")
ValueError: x and y must have same first dimension, but have shapes (721,) and (1,)
I don't think the index is working as expected when angle is an array input.
periodic_temp = periodic.sel(angle=q) # `q.shape` is `(721,)`
# but `periodic_temp.sizes` is `Frozen({'angle': 1})`
cc @ianhi
- 主要語言
- Jupyter Notebook
- 星號
- 204
- 分支
- 122
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
xarray-contrib/xarray-tutorial 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
-
help wanted
難度 4/5 3-5 天 新手友好度 48/100
xarray-contrib/xarray-tutorial#362 · 2 則留言 · 1 個 reaction ·
-
難度 2/5 1-3 小時 新手友好度 55/100
-
難度 5/5 一週以上 新手友好度 35/100
-
難度 4/5 3-5 天 新手友好度 38/100
查看 xarray-contrib/xarray-tutorial 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
EleutherAI/lm-evaluation-harness#4319 ·
維護者通常 1 天內回覆
-
needs triage
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 70/100
cowprotocol/token-lists#1533 ·
維護者通常 7 天內回覆
-
難度 2/5 1-3 小時 新手友好度 80/100
PathOfBuildingCommunity/PathOfBuilding-PoE2#2560 ·
維護者通常 4 天內回覆
-
check:passed streams:add
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆