【问题标题】:Mapping: Displaced longitude data on basemap映射:底图上的位移经度数据
【发布时间】:2016-03-12 02:45:28
【问题描述】:

我有这个基本的 python 代码来绘制我的全局数据,但是当我绘制它时,经度(x 值)似乎被移动了 - 向东移动.. 请检查下面的代码和结果

我的代码是:

file = 'frac_0.50.nc'
fileobj_giems = netCDF4.Dataset(file)

cmap = mpl.colors.ListedColormap([[0.0,0.9,1.0],[0.0,0.9,0.0],[1.0,0.9,0.0],[1.0,0.5,0.0],[1.0,0,0]])

frac = fileobj_giems.variables['fwetl'][8,:,:]
pr = frac[:]*100000
lon=fileobj_giems.variables['longitude'][:]
lat=fileobj_giems.variables['latitude'][:]
[lonall, latall] = meshgrid(lon, lat)
fig = plt.figure()
m = Basemap(llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
m.drawcoastlines()
m.drawcountries()
m.drawparallels(arange(-90.,90.,10.), labels = [1,0,0,0], fontsize = 10)
m.drawmeridians(arange(-180., 180., 10.), labels = [0,0,0,1], fontsize = 10)
levels=arange(2, 11.6, 0.8)
mymapf = plt.contourf(lonall, latall, pr, levels, cmap=cmap)
m.imshow(ma.masked_less_equal((pr),-999999999.),cmap=cmap)

pyplot.show()

渲染的结果如下:

As you see the 'y' seems to be fine but the 'x - lon' data is moved towards the east

附加信息,fileobj_giems.variables['fwetl'] 的形状为 (180, 360, 720) - (time, lat,lon)

【问题讨论】:

    标签: python mapping matplotlib-basemap


    【解决方案1】:

    看起来像是符号错误,因为这些点看起来偏移了 180 度;您应该检查输入数据的符号是否正确(北美点的经度应为负值。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-17
      • 2017-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-04
      • 2011-05-13
      • 1970-01-01
      相关资源
      最近更新 更多