Shiftdata breaks pcolormesh wrapping
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- matplotlib, numpy, python
调研方向
首先运行提供的 Basemap 1.0.7 pcolormesh 复现,并比较 lon_0=0 和 lon_0=180 的绘图。检查 pcolormesh 用于 wrapping 的 shiftdata 路径;当额外的行和列仍被忽略,且移位后的绘图与预期的全局网格匹配时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
I have a data grid which spans the whole globe from -180 -> 180. pcolormesh can plot this OK if I have lon_0=0 in which case Basemap doesn't have to do any wrapping

However if I do this for lon_0=180 (where Basemap has to shift some data), I get the following incorrect plot:

The code I have used for this is (using 1.0.7):
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
x = np.arange(-180, 190, 10)
y = np.array([40, 50, 60])
data = np.arange(72).reshape((2, 36))
xv, yv = np.meshgrid(x, y)
# Add an empty row and column of data so that the data is the same shape as X,Y
wider_data = np.ma.zeros(xv.shape)
for index, v in np.ndenumerate(data):
wider_data[index] = data[index]
for lon in (0, 180):
map = Basemap(lon_0=lon)
map.drawparallels(np.arange(-90, 90, 20), labels=[1, 1, 0, 1])
map.drawmeridians(np.arange(-180, 180, 30), labels=[1, 1, 0, 1])
map.pcolormesh(xv, yv, wider_data, latlon=True)
map.drawcoastlines()
plt.show()
I suspect that this problem is related to https://github.com/matplotlib/basemap/issues/182 because to get around that issue, I have had to add an empty row and column to the data. This should still be OK though, since that extra data should just be ignored (from the pcolormesh docs).
However, what actually happens is that the empty row gets moved around because shiftdata doesn't know it should ignore and so the plot is wrong.
- 主要语言
- Python
- 星标
- 818
- 派生
- 395
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matplotlib/basemap 的其他 Issue
-
small bug in drawmapscale可能已有人在做 @DavidVadnais 于 35 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 68/100
matplotlib/basemap#368 ·
-
难度 4/5 3-5 天 新手友好度 48/100
matplotlib/basemap#655 ·
-
难度 4/5 3-5 天 新手友好度 48/100
matplotlib/basemap#652 · 2 条评论 · 5 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 45/100
matplotlib/basemap#649 · 2 个 reaction ·
-
难度 5/5 一周以上 新手友好度 35/100
matplotlib/basemap#646 ·
查看 matplotlib/basemap 的全部 Issue
相似的 Issue
-
needs-human needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
gke-labs/kube-agents#2400 · 1 条评论 ·
维护者通常 1 天内回复
-
Device Details tables: FS/SF columns contradict each other (nfet_01v8 Vt row, pfet_01v8 Idsat row)未关闭
难度 2/5 1-3 小时 新手友好度 75/100
google/skywater-pdk#450 ·
-
Drained trajectory arrays are overwritten when the sequence buffer is reused可能已有人在做 @sylvesterkaczmarek 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
google-deepmind/bsuite#56 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
LearningCircuit/local-deep-research#7206 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
chingu-voyages/V62-tier3-team-33#285 ·
维护者通常 1 天内回复