lat_0,lon_0被Basemap忽略

时间:2015-07-08 19:53:52

标签: python matplotlib matplotlib-basemap

我正在尝试设置Basemap以使用Cylindrical Equal Area投影并将原点放置在特定的lat / lon(这是为了匹配某些输入x / y数据),但似乎设置{{1 }}和lat_0参数什么都不做。

lon_0

然后检查原点给出:

from mpl_toolkits.basemap import Basemap

# Oklahoma bounds 
# ('o' = origin at corner of Kingfisher/Logan/Canadian/Oklahoma counties)
lats = {'n':  37.1, 's':  33.6,  'c':  35.5, 'o':  35.726}
lons = {'e': -94.4, 'w': -103.0, 'c': -97.5, 'o': -97.674}

buf = 0.05 # plot buffer size (in degrees)

res = 'c' # map shapes resolution

# projection parameters
proj = 'cea' # cylindrical equal area
lat_ts = lats['c'] # true scale at geographic center
lon_0 = lons['o']  # x=0 at counties corner
lat_0 = lats['o']  # y=0 at counties corner

m = Basemap(projection = proj, lat_ts = lat_ts, resolution = res,
            lon_0 = lon_0, lat_0 = lat_0,
            urcrnrlon = lons['e'] + buf, urcrnrlat = lats['n'] + buf,
            llcrnrlon = lons['w'] - buf, llcrnrlat = lats['s'] - buf*4)

...这是地图边界的左下角,而不是我为In [15]: m(0, 0, inverse=True) Out[15]: (-103.05000000000305, 33.399999999963455) lat_0提供的坐标。如果我完全省略lat_0和lon_0,我会得到相同的输出。

起初,我认为CEA预测可能不支持这些参数,我应该手动移动我的数据,但the docs claim that lat_0 and lon_0 are used by all projections

作为一种解决方法,我可以设置偏移量来获得预期的结果:

lon_0

我现在已将此问题作为Basemap GitHub存储库中的问题提交。 https://github.com/matplotlib/basemap/issues/192

0 个答案:

没有答案