contour not closed across 0 meridian in polar projection
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- matplotlib, python
调研方向
先从使用 addcyclic() 和 Basemap.contour() 的 npaeqd 投影最小示例开始,然后检查轮廓路径在 0 度经线附近是如何返回的。完成标准是:闭合轮廓作为一条连续路径返回,而不是分成两部分,同时示例中跨越 180 度的轮廓仍然正确。
由索引模型根据 Issue 内容生成。
描述
Hi all,
I'm trying to fetch contour line coordinates from a npaeqd projection plot and I noticed that the contour lines will be broken into 2 parts whenever it crosses the 0-degree longitude, even though they form a closed contour and after calling addcyclic(). Below is minimal working example:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import addcyclic
from mpl_toolkits.basemap import Basemap
lats=np.linspace(0,90,90)
lons=np.linspace(0,360,360)
# make some toy data
xx,yy=np.meshgrid(lons,lats)
z=np.cos(xx*np.pi/180)*np.sin(yy*np.pi/180)
# add cyclic
z,lons=addcyclic(z,lons)
xx,yy=np.meshgrid(lons,lats)
# get contours
bmap=Basemap(projection='npaeqd',boundinglat=0,lon_0=0,
resolution='l')
fig=plt.figure(figsize=(12,6))
ax1=fig.add_subplot(1,2,1)
contours=bmap.contour(xx,yy,z,[-0.6,0.6],latlon=True,ax=ax1)
bmap.drawcoastlines(ax=ax1)
clines1=contours.collections[0].get_paths()
clines2=contours.collections[1].get_paths()
print 'len(clines1), num of contours across 180', len(clines1)
print 'len(clines2), num of contours across 0', len(clines2)
# plot contours
ax2=fig.add_subplot(1,2,2)
xs=clines1[0].vertices[:,0]
ys=clines1[0].vertices[:,1]
ax2.plot(xs,ys,'b-',label='Contour across 180')
xs=clines2[0].vertices[:,0]
ys=clines2[0].vertices[:,1]
ax2.plot(xs,ys,'r-',label='Half contour across 0')
xs=clines2[1].vertices[:,0]
ys=clines2[1].vertices[:,1]
ax2.plot(xs,ys,'g-',label='Half contour across 0')
ax2.legend()
plt.show(block=False)
Figure output here
The yellow contour on the left are made up by 2 lines (red+green) on the right. This makes it difficult when I try to detect and track some features that move across the 0-meridian.
Is it intended or a bug?
Some specs:
basemap 1.0.7
matplotlib 2.2.2, both installed via conda install
- 主要语言
- Python
- 星标
- 817
- 派生
- 395
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matplotlib/basemap 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
matplotlib/basemap#368 ·
-
难度 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 ·
-
难度 2/5 1-3 小时 新手友好度 48/100
matplotlib/basemap#645 · 2 条评论 ·
查看 matplotlib/basemap 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·