Stephen is being a bit modest by putting xray last in the list. I recommend it, and it is very painless to install. I could only get iris installed via a SciTools repo on binstar and even then, I had to tinker with a few things to get it working (and it was only the linux binaries, too).
Ben Root On Wed, Oct 15, 2014 at 3:44 PM, Chris Barker <[email protected]> wrote: > On Tue, Oct 14, 2014 at 11:30 AM, Fadzil Mnor <[email protected]> > wrote: > >> I've been trying to install IRIS on my laptop (OS X) for months. Errors >> everywhere. >> I'll look at that IRIS again, and other links. >> > > IRIS has been an install challeng,e but gotten better. > > And you ay even find a conda package for it if you use Anaconda -- I put > one up during Scipy -- they may be a newer build, though. > > -Chris > > > > >> Cheers, >> >> >> Fadzil >> >> On Tue, Oct 14, 2014 at 7:09 PM, Stephan Hoyer <[email protected]> wrote: >> >>> Hi Fadzil, >>> >>> My strong recommendation is that you don't just use numpy/netCDF4 to >>> process your data, but rather use one of a multitude of packages that have >>> been developed specifically to facilitate working with labeled data from >>> netCDF files: >>> - Iris: http://scitools.org.uk/iris/ >>> - CDAT: http://uvcdat.llnl.gov/ >>> - xray (my project): http://xray.readthedocs.org >>> >>> I can't answer your specific question without taking a careful look at >>> your data, but in very general terms, your code will have fewer bugs if you >>> can use meaningful labels to refer to your data rather than numeric ranges >>> like 396:757:12. >>> >>> Best, >>> Stephan >>> >>> >>> On Tue, Oct 14, 2014 at 3:50 AM, Fadzil Mnor <[email protected]> >>> wrote: >>> >>>> Hi all, >>>> I wrote a script and plot monthly mean zonal wind (from a netcdf file >>>> names uwnd.mon.mean.nc) and I'm not sure if I'm doing it correctly. >>>> What I have: >>>> >>>> >>>> ******************************************************************************** >>>> *#this part calculates mean values for january only, from 1980-2010; >>>> thus the index looks like this 396:757:12* >>>> >>>> def ujan(): >>>> f = nc.Dataset('~/data/ncep/uwnd.mon.mean.nc') >>>> u10_1 = f.variables['uwnd'] >>>> u10_2 = np.mean(u10_1[396:757:12,:,38,39:43],axis=0) >>>> return u10_2 >>>> >>>> uJan = ujan()* #calling function* >>>> >>>> *#this part is only to define lon, lat and level * >>>> q = nc.Dataset('~/data/ncep/uwnd.mon.mean.nc') >>>> lon=q.variables['lon'] >>>> lat=q.variables['lat'] >>>> lev=q.variables['level'] >>>> >>>> *#for some reason I need to define this unless it gave error "length of >>>> x must be number of column in z"* >>>> >>>> lon=lon[39:43] >>>> >>>> *#begin plotting* >>>> >>>> clevs=np.arange(-10.,10.,0.5) >>>> fig = plt.figure(figsize=(11, 8)) >>>> fig.clf() >>>> ax = fig.add_subplot(111) >>>> ax.axis([97.5, 105., 1000., 10.]) >>>> ax.tick_params(direction='out', which='both') >>>> ax.set_xlabel('Lon (degrees)') >>>> ax.set_ylabel('Pressure (mb)') >>>> ax.set_xticks(np.arange(97.5, 105., .5)) >>>> ax.set_yticks([1000, 700, 500, 300, 100, 10]) >>>> cs=ax.contourf(lon, lev, uJan, clevs, extend='both',cmap='seismic') >>>> plt.title('Zonal winds average (Jan, 1981-2010)') >>>> cax = fig.add_axes([0.99, 0.1, 0.03, 0.8]) >>>> aa=fig.colorbar(cs,cax=cax,orientation='vertical') >>>> aa.set_label('m/s') >>>> plt.savefig('~/uwind-crossection-test.png', bbox_inches='tight') >>>> >>>> ******************************************************************************* >>>> >>>> the result is attached. >>>> 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. >>>> >>>> Put the information above aside, *I just want to know if my slicing in >>>> the ujan() function is correct*. If it is, then, there must be nothing >>>> wrong(except my above mentioned assumption). >>>> The data file dimension is: >>>> *[time,level,latitude,longitude]* >>>> >>>> This part: >>>> *u10_2 = np.mean(u10_1[396:757:12,:,38,39:43],axis=0)* >>>> 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). >>>> I assume it will calculate a 30-year average of zonal wind for january >>>> only. >>>> Is this correct? >>>> >>>> Thank you. >>>> >>>> Fadzil >>>> >>>> _______________________________________________ >>>> NumPy-Discussion mailing list >>>> [email protected] >>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion >>>> >>>> >>> >>> _______________________________________________ >>> NumPy-Discussion mailing list >>> [email protected] >>> http://mail.scipy.org/mailman/listinfo/numpy-discussion >>> >>> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> [email protected] >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> >> > > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > [email protected] > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
