Counting from 0, subscript 2 is the 3rd index, which you have set to 'm'. If you print the value of 'm' you will see that it is not in the range of the third dimension of ZH. Try
print(getfilevardimsizes(f,"ZH")) to see the dimensionality of ZH. If 'mm' represents the month index you may need to subtract 1 to index the dimension properly. The subscript range is
always 0 to the dimension size -1. The main point is use print and printVarSummary to see for yourself what the problem is.
-dave
On Nov 15, 2011, at 10:00 AM, nlcheng wrote:
> I have try many times to change the errors but i still do not know why it put out errors.
> the line 45 is zh = fm->ZH(t, :, m, n) hope for your help .thank you very much .
> <截图1.png>
>
>
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "/usr/local/ncl/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> load "/usr/local/ncl/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;************************************************
> begin
> fname = "tdump11-4.txt"
> ncols = numAsciiCol(fname)
> nrows =numAsciiRow(fname)
> big = asciiread(fname,(/nrows,ncols/),"integer")
>
> strs = new((/nrows/),string)
> date=new((/nrows/),integer)
> hh=new((/nrows/),integer)
> nn =new((/nrows/),integer)
> mm =new((/nrows/),integer)
> ahgt=new((/nrows/),integer)
> do x =0,nrows-1
> date(x) = big(x,0)
> hh(x) = big(x,1)
> nn(x)= big(x,2)
> mm(x) = big(x,3)
> ahgt(x) = big(x,4)
>
> f = addfile("/storage/sdd2/xj/cmaq/20110304_nudge/CCTM_EA-SAPRC99_phot-inline-mpi_area_CONC."+date(x)+".nc","r")
> fm = addfile("/storage/sdd2/xj/MCIP/20110304_nudge/domain_1/METCRO3D_"+date(x)+".nc","r")
> fn = addfile("/storage/sdd2/xj/MCIP/20110304_nudge/domain_1/GRIDCRO2D_"+date(x)+".nc","r")
> fon = "tdump11-5.txt"
> t=hh(x)
> m=mm(x)
> n=nn(x)
>
> zh = fm->ZH(t, :, m, n)
> ht = fn->HT(0, 0,m, n)
> height = zh+ht
> so2 = f->SO2(t, :, m, n)
> co = f->CO(t, :, m, n)
> o3 = f->O3(t, :, m, n)
> no = f->NO(t, :, m, n)
> no2 = f->NO2(t, :, m, n)
>
> SO2 = 1000*linint1 (height, so2, True, ahgt(x), 0)
> CO = 1000*linint1 (height, co, True, ahgt(x), 0)
> O3 = 1000*linint1 (height, o3, True, ahgt(x), 0)
> NO = 1000*linint1 (height, no, True, ahgt(x), 0)
> NO2 = 1000*linint1 (height, no2, True, ahgt(x), 0)
> NOx=NO+NO2
>
> vals = sprinti("%0.4i",date(x)) + sprinti("%0.2i",hh(x)) + " "+ \
> sprintf("%10.6f",SO2) + " " + sprintf("%10.6f",CO) + " " + sprintf("%10.6f",O3) + " " + sprintf("%10.6f",NOx)
>
> strs(x) = vals
> end do
> asciiwrite("tdump11-5.txt",strs)
> end
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 15 11:03:37 2011
This archive was generated by hypermail 2.1.8 : Thu Nov 17 2011 - 11:50:12 MST