Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
basemap problem
#1
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/zv1zp69k...1m32kn.jpg
thanks
Reply
#2
Hi,

I can assist you. Please check your PM for more details.

Victor
Reply
#3
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)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Issue plotting coordinates using Basemap kiton 5 8,231 Mar-09-2017, 07:33 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020