NNcocommand:注意:nc文件中的文件名最好不要用数字开头,1.ncdump–hnc文件名查看nc文件的信息2.ncrcat2001.nc2002.nc2003.ncout.ncn个nc文件按时间顺序合并3.ncks:ncks-dtime,624,635nswrs.mon.mean.kang.ncnswrs.month.00.nc将时次624到635的资料从nswrs.mon.mean.kang.nc中分割出来放在nswrs.month.00.nc中ncks-A-vuavg,vavgin.ncout.nc将in.nc中的uavg,vavg变量添加到out.nc中去,同时in.nc和out中的cordinatevariablename重复,in.nc中的cordinatevariable替换out.nc中的coordinatevariablencks-O-x-vUSin.ncout.nc:RemoveUSvariablefromin.nc,thatis,theout.nccontainsallvariablesofin.ncexceptUSncks–O–dlon,12in.ncout.nc:subsetvariableswithlon(12)ncks–O–dlon,12.in.ncout.nc:subsetvariableswithlon=12.4.ncea–dtime,0,2–dlat,0,3685.nc86.nc87.ncave.nc,对前面多个文件在规定的维数范围内求平均,放在后面一个文件里面。5.ncl_convert2nca.grb,将grb文件转化成为nc文件6.ncl_filedump–ca.grb7.8、ncatted:比较简单,但是也比较容易出错,最好参考教材ncatted-O-aunits,y_T,o,c,nounitsoda_test_restore.nc为变量y_T的units属性修改为字符型属性nounitsncatted-O-acartesian_axis,grid_y_T,c,c,Yoda_test_restore.nc为变量grid_y_T增加属性cartesian_axis=”Y”ncatted-acase,global,m,c,fwffwf.cpl.r.1941-01-01-00000.nc:changeglobalattributes.ncatted-amissing_value,temp,m,f,36oda_sub_kang.nc将变量的缺省值修改为36.0,注意,修改的不仅是metadata,而且也修改了temp变量里面缺省值的值为36.0,注意,此时最好_Fill_Value最好不要出现ncatted-O-afilename,global,m,c,temp_sfc_restore.ncoda_test_restore.nc修改oda_test_restore.nc中globalattributes下面filename的值为temp_sfc_restore.ncncatted-aTITLE,global,c,c,OUTPUTFROMWRFV3.3MODELwrf.d01.ncncatted-O-acalendar,time,d,,,u10_07sep1_08mar2.nc删除time的calendar属性9、ncrename:ncrename–vtemp,temin.nc给变量改名ncrename–dlat1,latin.nc给坐标改名10、ncap2(ncap):必须要两个文件名:in.ncout.ncncapusuallylosestheattributewhilencap2keepsattribute.ncap2-O-s'anomaly_2hour_outchange=temp-temp_restore'in.ncout.nc两个变量相减生成第三个变量ncap2-O-s'temp_oda=float(temp_oda)'in.ncout.nc将in.nc中的变量temp_oda转变成float类型ncap2–O–s‘lon_lat[lon,lat]=lat+lon’in.ncout.nclat和lon分别是一维数组,产生一个二维数组lon_lat(lon,lat)11、ncpdq:ncpdq-a-latoda_sub_kang.ncout.nc改变lat的排列方向ncpdq-aT,Z,Y,X-vtemptemperature_jccom.ncout.nc改变变量temp的排放顺序为temp(t,z,y,x)ncpdq-azt,TIMEregrid_3d.ncout.ncchangetherecorddimensionfromTIMEtoztncpdqin.ncout.ncallvariabletonc_shortncpdq–Uin.ncout.ncunpackallvariabletofloat12、ncrancra-dTIME,0,30,1u_10.ncu.nc对u_10.nc的第一个月求平均值13、ncwa:Note:onlyvalidinonedimensionaverage.ncwa-O–alonin.ncout.ncstorethezonalmeanofin.ncinout.nc14ncboneedonly3files.ncbo-O--op_typ=add/sub/mlt/dvdin1.ncin2.ncout.nc“ncboperformsbinaryoperations(additionsubtractionmultiplicationdivision,file1+-*/file2=out.nc)onvariablesinfile1andcorrespondingvariables(thosewiththesamename)infile2andstorestheresultsinfile315ncflintncflint-O-C-vprs_sfc-w0.01,0.0in.ncin.ncout.nc-C,whichcausesNCOtonotautomaticallyaddcoordinatestothevariablesappearingintheoutput-file.Rescalethedimensionalunitsofthesurfacepressureprs_sfcfromPascalstohectopascals(millibars)含nc文件的fortran编译命令ifort-ofortran.exefortran1.f90-I/usr/local/include-L/usr/local/lib–lnetcdf17上用32位编译:xlf90layer.f90-I/gpfs/fs4/kangxb/software/software.32bit/include-L/gpfs/fs4/kangxb/software/software.32bit/lib-lnetcdfXlf90–ca.f90只编译不链接Segmentationfault:堆栈不够的标志,此时尝试用-q64编译,如果还不行,就只好修改程序,减少堆栈GRADS:1、grads二进制文件转换成为nc文件:lats4d-itest.ctl-otest.nc-ftypectl-varsclfmi2、命令行执行lats4d:gradsc-lbclats4d-v-q-imodel-oex1CDO./configureCC=pgcc--prefix=/global/u2/k/kang/software/cdo-1.4.3--with-netcdf=/opt/cray/netcdf/4.0.1.0/netcdf-pgi/--with-hdf5=/opt/cray/hdf5/1.8.3.0/hdf5-pgi/--with-szlib=/usr/common/usg/szip/2.1/pgi/./configureCC=pgcc--prefix=/global/u2/k/kang/software/cdo-1.4.3--with-netcdf=/opt/cray/netcdf/4.0.1.0/netcdf-pgi--with-hdf5=/opt/cray/hdf5/1.8.5.0/hdf5-pgi/--with-szlib=/usr/common/usg/szip/2.1/pgi/onevergreen:./configure--prefix=/homes/xkang/software/cdo--with-netcdf=/cell_root/software/netcdf/4.1.1/intel400CC=icc--with-hdf5=/cell_root/software/hdf/1.8.6/intel/sys/includeLIBS='-lcurl'./configure--prefix=/homes/xkang/software/cdo--with-netcdf=/cell_root/software/netcdf/4.1.1/intel400CC=iccLIBS='-lcurl-lgssapi_krb5-lssl-lcrypto-ldl-lidn-ldes425-lkrb5-lk5crypto-lcom_err-lkrb5support-lresolv'1.binary-nc/global/u2/k/kang/software/cdo-1.4.3/bin/cdo-fncimport_binaryin.ctlout.nc2.nc-grib::1、specifyinglargenumberfiles:ncfilename=alphanumeric_prefix+numeric_suffix+’.’+filetype#ncea/ncecat/ncra/ncrcat–nfile_number,digit_number,numeric_increment#wheredigitnumberisthefixednumberofnumericdigitscomprisingthenumeric_suffix,asthefollowingexample:digit_numberis2,noalphanumeric_prefix,ifdigit_numberis1,thenthealphanumeric_prefixis8.ncra–n5,2,185.nc8589.nc#ncra85.nc86.nc87.nc88.nc89.nc8589.ncspecialskills:2、converttimefromarecorddimensiontoanon-recorddimensionncecatin.ncout.nc#Converttimetonon-recorddimensionncwa-arecordin.ncout.nc#Removenewdegeneraterecorddimension3、converttimefromafixeddimensiontoarecorddimensionncecatin.ncout.nc#createarecorddimension:“record”ncpdq-aTIME,recordout.ncin.nc#changetherecorddimensionfrom“record”toTIMEncwa-arecordin.ncout.nc#Removenewdegeneraterecorddimension4、howtogluetimedimensionlackingfilestogetherwithtimedimensionadded?(ex:temp_0hour(lat,lon),temp_6hour(lat,lon)totemp(time,lon