<div dir="ltr">Hi all,<div>I wrote a script and plot monthly mean zonal wind (from a netcdf file names <a href="http://uwnd.mon.mean.nc">uwnd.mon.mean.nc</a>) and I'm not sure if I'm doing it correctly. What I have:</div><div><br></div><div><b>******************************************************************************</b></div><div><i>#this part calculates mean values for january only, from 1980-2010; thus the index looks like this 396:757:12</i></div><div><br></div><div><div>def ujan():</div><div>    f = nc.Dataset('~/data/ncep/<a href="http://uwnd.mon.mean.nc">uwnd.mon.mean.nc</a>')</div><div>    u10_1 = f.variables['uwnd']</div><div>    u10_2 = np.mean(u10_1[396:757:12,:,38,39:43],axis=0)</div><div>    return u10_2</div><div><br></div><div>uJan = ujan()<i> #calling function</i></div><div><br></div><div><i>#this part is only to define lon, lat and level </i></div><div>q = nc.Dataset('~/data/ncep/<a href="http://uwnd.mon.mean.nc">uwnd.mon.mean.nc</a>') </div><div>lon=q.variables['lon']</div><div>lat=q.variables['lat']</div><div>lev=q.variables['level']</div><div><br></div><div><i>#for some reason I need to define this unless it gave error "length of x must be number of column in z"</i></div><div><i><br></i></div><div>lon=lon[39:43]</div><div><br></div><div><i>#begin plotting</i></div><div><br></div><div>clevs=np.arange(-10.,10.,0.5)</div><div>fig = plt.figure(figsize=(11, 8))</div><div>fig.clf()</div><div>ax = fig.add_subplot(111)</div><div>ax.axis([97.5, 105., 1000., 10.])</div><div>ax.tick_params(direction='out', which='both')</div><div>ax.set_xlabel('Lon (degrees)')</div><div>ax.set_ylabel('Pressure (mb)')</div><div>ax.set_xticks(np.arange(97.5, 105., .5))</div><div>ax.set_yticks([1000, 700, 500, 300, 100, 10])</div><div>cs=ax.contourf(lon, lev, uJan, clevs, extend='both',cmap='seismic')</div><div>plt.title('Zonal winds average (Jan, 1981-2010)')</div><div>cax = fig.add_axes([0.99, 0.1, 0.03, 0.8]) </div><div>aa=fig.colorbar(cs,cax=cax,orientation='vertical')</div><div>aa.set_label('m/s')</div><div>plt.savefig('~/uwind-crossection-test.png', bbox_inches='tight')</div></div><div><b>*****************************************************************************</b></div><div><br></div><div>the result is attached.</div><div>I have no idea how to confirm the result (at least until this email is written) , but I believe the lower altitude values should be mostly negative, because over this region, the zonal wind are usually easterly (thus,negative values), but I got positive values.</div><div><br></div><div>Put the information above aside, <u>I just want to know if my slicing in the ujan() function is correct</u>. If it is, then, there must be nothing wrong(except my above mentioned assumption).</div><div>The data file dimension is:</div><div><b>[time,level,latitude,longitude]</b></div><div><br></div><div>This part:</div><div><b>u10_2 = np.mean(u10_1[396:757:12,:,38,39:43],axis=0)</b><br></div><div>The line above will calculate the mean of zonal wind (uwnd) in a range of time index 396 to 757 for each year (january only), for all vertical level, at latitude index 38 (5 N) and in between longitude index 39 to 43 (97.5E-105E).</div><div>I assume it will calculate a 30-year average of zonal wind for january only.</div><div>Is this correct?</div><div><br></div><div>Thank you.</div><div><br></div><div>Fadzil</div></div>