![]() |
basemap problem - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: basemap problem (/thread-4111.html) |
basemap problem - Roman - Jul-24-2017 hallo, could me by anybody solve my problem why draw long line on map see image[Image: zv1zp69kdz8nqr1m32kn.jpg] my code: m = Basemap(projection='cyl',lon_0=0,resolution='c') plt.figure(figsize=(15,7)) x, y = m(lons, lats) palette = plt.cm.jet cs = m.pcolormesh(x,y,np.squeeze(sst),cmap=palette) plt.clim(270,310) m.fillcontinents(color='brown') cbar = m.colorbar(cs, location='right', pad=0.15) cbar.set_label('Kelvin',color='white') t = cbar.ax.get_yticklabels(); labels = [item.get_text() for item in t] cbar.ax.set_yticklabels(labels, color = 'white') plt.savefig('sst.png', facecolor='white',dpi=300) http://www.imageworld.sk/images/zv1zp69kdz8nqr1m32kn.jpg thanks RE: basemap problem - victor_cis - Jul-24-2017 Hi, I can assist you. Please check your PM for more details. Victor RE: basemap problem - Roman - Jul-24-2017 victor, I am amateur in python programing ,what is PM please, If i change map to polar south or north stereograph. problem is solved but i need world map projec., full my code : from netCDF4 import Dataset import numpy as np import os Folder="D:\\MSG Data\\PROCESSED\\sst_nc" for (path, dirs, files) in os.walk(Folder): for dir in dirs: print dir for sst in files: if sst[-3:]=='.nc': file=os.path.join(path,sst) fh = Dataset(file, mode='r') lons = fh.variables['lon'][:] lats = fh.variables['lat'][:] sst = fh.variables['sea_surface_temperature'][:] fh.close() import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap m = Basemap(projection='cyl',lon_0=0,lat_0=0,resolution='c') plt.figure(figsize=(15,7)) xi, yi = m(lons, lats) palette = plt.cm.nipy_spectral cs = m.pcolormesh(xi,yi,np.squeeze(sst),cmap=palette) plt.clim(270,310) m.fillcontinents(color='white') plt.savefig('D:\MSG Data\sst.png', facecolor='white',dpi=300) |