<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Mary already answered this in her email prior to this one?<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="gmail_default" style="text-align: left; font-size: small;">Assuming that "filename1" is a list of 29 files, you will also need to change this line:</div></div><div class=""><div class="gmail_default" style="text-align: left; font-size: small;"><br class=""></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left; font-size: 12.8px;" class=""> lines = asciiread(fin1[i],-1,"string")</div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left;" class=""><br class=""></div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left;" class="">to be:</div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left;" class=""><br class=""></div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div class=""><div style="text-align: left; font-size: 12.8px;" class=""> lines = asciiread(filename1(i),-1,"string")</div></div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left;" class=""><br class=""></div></div></div><div class=""><div class="gmail_default" style="font-size: small;"><div style="text-align: left;" class="">—Mary</div></div></div></blockquote><div class=""><div class="gmail_default" style="font-size: small;"><div class=""><br class=""></div><div class=""><br class=""></div><div class="">x[i] -> list</div><div class="">x(i) -> array</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div></div><div><blockquote type="cite" class=""><div class="">On 20 Jun 2016, at 03:03, grace <<a href="mailto:313695096@qq.com" class="">313695096@qq.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">Hi:</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> All,I have write a script to read and calculate .csv data according to the "Reading csv"<span style="line-height: 1.5;" class="">example on the NCL website,but it appears warning and fatal:</span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><div style="line-height: 23.7999992370605px;" class="">fatal:List subscripting used on non-list variable, can't continue</div><div style="line-height: 23.7999992370605px;" class="">fatal:["Execute.c":8567]:Execute: Error occurred at or near line 37 in file csv_read.ncl</div><div class=""><br class=""></div></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ........</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">.........</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">........</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">I think maybe there are some problems with the way my data stored,</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">I have 29 files which named with date like this:</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><div class="">
<span id="cid:F8416A17@55B5D06B.47956757.png"><F8416A17@55B5D06B.47956757.png></span></div><div class="">Each file include some same named csv data:</div><div class=""><div class="">
<span id="cid:BE4949AD@55B5D06B.47956757.png"><BE4949AD@55B5D06B.47956757.png></span><span id="cid:BE44186F@55B5D06B.47956757.png"><BE44186F@55B5D06B.47956757.png></span></div></div><div class=""><br class=""></div><div class="">I can not figure a better way to read data of the Caotan.csv of the all date-files and calculate them,can anyone help me or give me some good idea?</div></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">This is my script:</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ;</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">begin</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> filename1=systemfunc("ls /public/home/huanglei/cmaqdata/2016*/Caotan.csv")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> time_al= new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> oth_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> xa_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> tc_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> bj_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> xy_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> wn_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ya_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> hz_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> yl_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ak_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> sl_al = new((/29,24/),float,"No_FillValue")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> do i=0,28</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ;---Read in file as array of strings so we can parse each line.</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> lines = asciiread(filename1[i],-1,"string")</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> nlines = dimsizes(lines)-1 ; First line is a header</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ;</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ; Start reading in the fields we care about:</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ; The first line is a header, so skip this.</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ;</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> delim = ","</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> time = str_get_field(lines(1:25),1,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> oth = str_get_field(lines(1:25),2,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> xa = str_get_field(lines(1:25),3,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> tc = str_get_field(lines(1:25),4,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> bj = str_get_field(lines(1:25),5,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> xy = str_get_field(lines(1:25),6,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> wn = str_get_field(lines(1:25),7,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ya = str_get_field(lines(1:25),8,delim)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> hz = str_get_field(lines(1:25),9,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> yl = str_get_field(lines(1:25),10,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ak = str_get_field(lines(1:25),11,delim) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> sl = str_get_field(lines(1:25),12,delim)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> <span class="Apple-tab-span" style="white-space: pre;">        </span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> time_al(i,:)= time <span class="Apple-tab-span" style="white-space: pre;">        </span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> oth_al(i,:) = oth </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xa_al(i,:) = xa </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> tc_al(i,:) = tc </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> bj_al(i,:) = bj </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xy_al(i,:) = xy </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> wn_al(i,:) = wn </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ya_al(i,:) = ya </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> hz_al(i,:) = tc </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> yl_al(i,:) = bj </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ak_al(i,:) = xy </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> sl_al(i,:) = wn</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">        </span> end do</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> time_all=ndtooned(time_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> oth_all=ndtooned(oth_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xa_all=ndtooned(xa_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> tc_all=ndtooned(tc_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> bj_all=ndtooned(bj_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xy_all=ndtooned(xy_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> wn_all=ndtooned(wn_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ya_all=ndtooned(xy_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> hz_all=ndtooned(wn_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> yl_all=ndtooned(ya_al) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ak_all=ndtooned(ak_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> sl_all=ndtooned(sl_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> print(time_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ; calculate the avg</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> oth_avg=avg(oth_al)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xa_avg=avg(xa_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> tc_avg=avg(tc_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> bj_avg=avg(bj_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> xy_avg=avg(xy_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> wn_avg=avg(wn_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""> ya_avg=avg(xy_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> hz_avg=avg(wn_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ya_avg=avg(ya_all) </div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ak_avg=avg(ak_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> sl_avg=avg(sl_all)</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> ssx = hz_avg + ak_avg + sl_avg</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><span class="Apple-tab-span" style="white-space: pre;">                        </span> nsx = ya_avg + ya_avg</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class="">end</div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><br class=""></div><div style="font-family: 'lucida Grande', Verdana, 'Microsoft YaHei'; line-height: 23.7999992370605px;" class=""><div style="line-height: 23.7999992370605px;" class="">My NCL version is 6.2.0.</div><div style="line-height: 23.7999992370605px;" class=""> How can I slove the problem?</div></div>_______________________________________________<br class="">ncl-talk mailing list<br class=""><a href="mailto:ncl-talk@ucar.edu" class="">ncl-talk@ucar.edu</a><br class="">List instructions, subscriber options, unsubscribe:<br class="">http://mailman.ucar.edu/mailman/listinfo/ncl-talk<br class=""></div></blockquote></div><br class=""></div></body></html>