matplotlib / matplotlib/basemap

llcrnrlon vs llcrnrx [-180, 180 vs 0, 360]

未关闭
#155 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
817
派生
395
PR 合并指标
30 天内没有已合并 PR

描述

I was playing with the projections and it took me a while to understand what's going on... I need the `'rotpole'` projection to convert some locations and plot some graphs. I have all the information: `lon_0 = 10, o_lon_p = 10, o_lat_p = 10`, but I don't have the real lat/lon, I have the rotated one so I'm forced to use `llcrnrx, llcrnry...`.

I have a climate model that gives me the output in this rotated pole projection with rotated left lon = -19.5, rotated right lon = 21, rotated bottom lat = -25, rotated top lat = 20.5.

First take:

``` python
import mpl_toolkits.basemap as mb
kwargs = {
'projection': 'rotpole',
'llcrnrx': -19.5,
'llcrnry': -25,
'urcrnrx': 21,
'urcrnry': 20.5,
'o_lon_p': 10,
'o_lat_p': 32.5,
'lat_0': 10
}
m = mb.Basemap(**kwargs)
```

Now `m.drawcoastlines()` will give me a huge map that goes backwards on X axis... After a full day of investigation... I saw that `m.llcrnrx' takes the value of`360-19.5 = 340.5`and`m.urcrnrx = 21` so this clearly dosn't work...

![rotpole](https://cloud.githubusercontent.com/assets/1177508/3072050/deb6ba2c-e2c0-11e3-9bcf-221ed20debaf.png)

Is this behaviour wanted? I mean, when building `m = mb.Basemap(...)` using `llcrnrlon, llcrnrlat...` you can safely pass negative values to `llcrnrlon` but when using `llcrnrx` you're forced to use `(0, 360)`...

Working version is:

``` python
import mpl_toolkits.basemap as mb
kwargs = {
'projection': 'rotpole',
'llcrnrx': 0,
'llcrnry': -25,
'urcrnrx': 21,
'urcrnry': 40.5,
'o_lon_p': 10,
'o_lat_p': 32.5,
'lat_0': -9.5
}
m = mb.Basemap(**kwargs)
```

So now I'm forced to do:

``` python
# x, y taken from climate model
xoffset = 19.5
lon, lat = m([x + xoffset], [y], inverse=True)
```

Even more confusing is the fact that you can use negative values in convert as in `m(-1, 0, inverse=True)` and you get the correct negative real longitude value...

_Edit_: using version 1.0.7; fixed `'urcrnry'` misspell

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用报告中的旋转极坐标复现所提供的 Basemap 构造函数和逆转换示例。检查 Basemap 入口点如何处理 llcrnrx 和 urcrnrx 范围,然后确定预期的坐标行为,并为旋转经度为负的情况添加覆盖。文档中记录的坐标范围与最终的地图方向一致,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。