Hi,Thanks for your help.  I do some test for my ncl code and get :
If I set the code as:
......
filName = "/home/linx/NCDC/GHCN/Grid/Grid_PRCP_1900-2005_Ascii.dat"
print(filName)
data = asciiread(filName,(/36*72*106,15/),"float")   ; 36 lat grid,72 lon grid,106 years
printVarSummary(data)                      ; NCL can get the data value the give a output soon
nRow    =  numAsciiRow (filName)    ; It seem that ncl can't get a nRow value 
nCol    =  15
print("nRow="+nRow)                        ; Ncl also give no output for nRow
.........
If I set the code directly as :
filName = "/home/linx/NCDC/GHCN/Grid/Grid_PRCP_1900-2005_Ascii.dat"
 Row     =  numAsciiRow (filName)
 nCol    =  15
 print("nRow="+nRow)
 data    = asciiread (filName, (/nRow,nCol/), "float")
 printVarSummary(data)
ncl can't read data and give no result
I wonder if the function of "numAsciiRow" can give a correct return for my ascii data file
and why ?  
I'm sorry for sending mail directly to you. It's my fault . Next time I won't directly reply the received
mail. And thanks again for your mails.
Lin
LEO_ARIES
2006-05-19
发件人: Dennis Shea
发送时间: 2006-05-19 01:01:51
收件人: Leo_Aries_at_tom.com
抄送: ncl-talk_at_ucar.edu
主题: Re: Re: [ncl-talk] How to read a 3-d ascii grid data file ?
>Thanks  for  the    reply.  I  have  set  my  data  as  the  format  below:
>
>190001.0      87.50    -157.50      -327.68      -327.68      -327.68      -327.68      -327.68      
-327.68      -327.68  
>190001.0      87.50    -152.50      -327.68      -327.68      -327.68      -327.68      -327.68      
-327.68      -327.68
>........
>the  1st  column  is  yyyymm  (float)  and  2nd/3rd  is  lat/lon,  the  other  right  12  
colums  is  the  value  of  Jan  to  Dec.
>  
>I  use  the  code  below  to  read  it,But  still  can't  get  the  right  result.
>(NCL  use  more  than  95%  of  my  xeon  cpu,but  fail  to  finish  running)
>
>
>load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>;*****************************************************
>begin  
>filName  =  "Grid_PRCP_1900-2005_Ascii.dat"
>nRow        =    numAsciiRow  (filName)
>nCol        =    15
>
>data        =  asciiread  (filName,  (/nRow,nCol/),  "float")
>printVarSummary(data)                ;  It  seem  that  ncl  stop  here  because  the  
printVarSummary(data)
>                                                                                  didn't  give  a  output    
>
>yyyymm    =  floattointeger(data(:,0))  ;    this  convert  float  to  integer
>
>lats        =  data(0:2591,1)            ;  36*72=2592  grids  
>lons        =  data(0:2591,2)
>PRCP        =  data(:,3:)
>
>PRCP!0        =  'lat'                              
>PRCP!1        =  'lon'
>PRCP!2        =  'time'
>PRCP_at_lat  =  lats
>PRCP_at_lon  =  lons
>PRCP_at_time  =  ?                                ;I  also  want  to  know  how  to  set  time  property  of  
PRCP  appropriately.
________________________________________
Well,  first  of  all,  PRCP  is  not  a  lat/lon  grid.
It  is    PRCP(nROW,12)  where  the  12  represents  months  of  the  year.
I  suggest  that  you  use  "printVarSummary"  often  to  look
at  an  overall  view  of  your  variable.
The  following  is  untested  and  should  give  you  a  start.
begin  
 filName  =  "Grid_PRCP_1900-2005_Ascii.dat"
 nRow        =    numAsciiRow  (filName)
 print("nRow="+nRow)
 nCol        =    15
 data        =  asciiread  (filName,  (/nRow,nCol/),  "float")
 printVarSummary(data)                ;  It  seem  that  ncl  stop  here  because  the    
                                                                                   didn't  give  a  output    
 DATA        =  data(:,3:)                  ;  (nRow,12)
 yrStrt    =  1900
 yrLast    =  2005
 nyrs        =  yrLast-yrStrt+1
 nmos        =  12
 ntim        =  nyrs*nmos          
 time        =  new  (  ntim,  "integer")
 nt  =  0
 do  yr=yrStrt,yrLast
       time(nt:nt+nmos-1)  =  yr*100  +  ispan(1,nmos,1)
       nt  =  nt+nmos
 end  do
 time_at_long_name  =  "year_month"
 time_at_units          =  "yyyymm"
 time!0    =  "time"
 time&time  =  time
 printVarSummary(time)
 nlat        =
 mlon        =
 latStrt  =  87.5
 lonStrt  =  -157.5
 dlat        =  2.5                ;  ???
 dlon        =  2.5
 lon          =  ispan(0,mlon-1)*dlon  +  lonStrt
 lon!0      =  "lon"
 lon_at_long_name  =  "longitude"
 lon_at_units          =  "degrees_east"
 lon&lon  =    lon
 printVarSummary(lon)
   
 lat          =  ispan(0,mlon-1)*dlon  +  lonStrt
 lat!0      =  "lon"
 lat_at_long_name  =  "latitude"
 lat_at_units          =  "degrees_north"
 lat&lat  =    lat
 printVarSummary(lat)
 PRCP            =  new  (  (/ntim,nlat,mlon/),  "float")
 PRCP!0        =  "time"                              
 PRCP!1        =  "lat"
 PRCP!2        =  "lon"
 PRCP&lat    =    lat  
 PRCP&lon    =    lon  
 PRCP&time  =    time
 PRCP_at_long_name  =  "..."
 PRCP_at_units          =  "..."
 nt  =  0
 do  nr=0,nRow-1                                                            ;  loop  over  rows  
       PRCP(nt:nt+11,:,:)    =  (/  DATA(nr,:)  /)      ;  store  12  months  of  data
       nt  =  nt+12
 end  do
 printVarSummary(PRCP)
 printMinMax(PRCP,  True)
end  
Please  do  not  email  me  directly.  I  do  see  ncl-talk  
_______________________________________________
ncl-talk  mailing  list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu May 18 2006 - 12:39:01 MDT
This archive was generated by hypermail 2.2.0 : Fri May 19 2006 - 10:20:02 MDT