Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
basemap problem
#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


Messages In This Thread
basemap problem - by Roman - Jul-24-2017, 07:13 AM
RE: basemap problem - by victor_cis - Jul-24-2017, 08:31 AM
RE: basemap problem - by Roman - Jul-24-2017, 08:48 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Issue plotting coordinates using Basemap kiton 5 8,344 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