0

I wanted to plot streamlines with NOAA composite (2.5*2.5 lon/lat) from 30 west to 10 east ( I definitely want the map to be from west to east(. I tried to draw it with basemap (The codes are attached). But the stream lines are not plotted in the western longitudes. I would be very grateful if someone could help me solve this problem. My codes attempting to solve the problem:

    from netCDF4 import Dataset as NetCDFFile 
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from matplotlib.patches import Rectangle
from matplotlib.patches import Polygon
import numpy as np
from mpl_toolkits.basemap import Basemap
fig = plt.figure(figsize=(18,15))
ax = fig.add_subplot(111)
nc1 = NetCDFFile('E:/cycle-of-Mjo/NOAA/nc/u850b1.nc')
nc2 = NetCDFFile('E:/cycle-of-Mjo/NOAA/nc/v850b1.nc')
lat = nc1.variables\['lat'\]\[:\]
lon = nc1.variables\['lon'\]\[:\]
U= nc1.variables\['uwnd'\]\[:\]
V= nc2.variables\['vwnd'\]\[:\]
map = Basemap(projection='cyl',llcrnrlon=-40.,llcrnrlat=-30.,urcrnrlon=150.,urcrnrlat=61.,resolution='i' ,suppress_ticks=False)
lat_ticks=np.arange(np.ceil(-30.0),int(61.0),20)
lon_ticks=np.arange(np.ceil(-40.0),int(150.0),30)
lon_ticks_proj, \_=map(lon_ticks, np.zeros(len(lon_ticks)))
\_, lat_ticks_proj=map(np.zeros(len(lat_ticks)), lat_ticks)
ax.set_xticks(lon_ticks_proj)
ax.set_yticks(lat_ticks_proj)
plt.tick_params(labelleft=False, labelbottom=False , axis='both',which='major')
map.drawcoastlines()
map.drawcounties()
parallels = np.arange(-30.,61.,20.)
meridians = np.arange(-40,150.,30.)
map.drawparallels(lat_ticks,labels=\[1,0,0,0\],fontsize=12 , dashes=(0,1), fontweight='bold')
map.drawmeridians(lon_ticks,labels=\[0,0,0,1\],fontsize=12 , dashes=(0,1), fontweight='bold')
lons,lats= np.meshgrid(lon,lat)
x,y = map(lons,lats)
Q = plt.streamplot(lon\[::5\],lat\[::-5\],U\[0,::-5,::5\],V\[0,::-5,::5\],linewidth=1, density=2 ,arrowstyle='-\>', arrowsize=2, color='k',minlength=0.05)

enter image description here

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.