<div dir="ltr">are you sure that your subscripts are within the range of the variable. print each and compare to printVarSummary of XLAT, please.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 3:51 PM Borja Sas González <<a href="mailto:saszalez@gmail.com">saszalez@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">I don't see anything weird. The message prints that there is an error on line 51:<br></div><div dir="ltr"><br></div><div dir="ltr"><span style="font-family:monospace">lat1 = a[0]->XLAT(0,nlt,nln) ; nearest grid point</span><br></div><div dir="ltr"><span style="font-family:monospace"><br></span></div>But I also see nothing wrong.<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 7 ago. 2019 a las 13:01, Barry Lynn (<<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi:<div><br></div><div>I am not sure which variable is being printed in error, but you are trying to subscript (add indices) to a variable that doesn't have them. Try to solve your problem by finding the variable. You can printVarSummary to see the dimensions of each.</div><div><br></div><div>Barry</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 7, 2019 at 2:40 PM Borja Sas González via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I am trying to write a csv to represent several variables. To make it easy, copy the example from the NCL page (write_csv_5.ncl) that represents the temperature at 2 m.</div><div><br></div><div>The only changes I made in the script are the output file of the WRF that you are going to read and the map points that I want.</div><div><br></div><div>When executing it, the following error is printed:</div><div><br></div><font face="monospace">fatal:List subscripting used on non-list variable, can't continue<br>fatal:["Execute.c":8637]:Execute: Error occurred at or near line 51 in file csv.ncl</font></div><div dir="ltr"><br><div>The script is:</div><div><br></div><div><div><font face="monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</font></div><div><font face="monospace">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">begin</font></div><div><font face="monospace"> </font></div><div><font face="monospace"> a = addfile("/home/bsas/wrf_wind/WRF/test/em_real/wrfout_d03_2019-08-07_00:00:<a href="http://00.nc" target="_blank">00.nc</a>","r")</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"> times = wrf_user_list_times(a) ; "2019-08-01_12:00:00", etc</font></div><div><font face="monospace"> tk2 = wrf_user_getvar(a,"T2",-1) ; T2 in Kelvin</font></div><div><font face="monospace"><br></font></div><div><font face="monospace"> times = wrf_user_list_times(a)</font></div><div><font face="monospace"> ntimes = dimsizes(times)</font></div><div><font face="monospace"> print("ntimes = " + ntimes)</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">;---Calculate i,j locations of data closest to set of lat/lon points</font></div><div><font face="monospace"> lats = (/28.290147,28.379555/)</font></div><div><font face="monospace"> lons = (/-16.377643,-16.585276/)</font></div><div><font face="monospace"> nlatlon = dimsizes(lats)</font></div><div><font face="monospace"> loc = wrf_user_ll_to_xy(a, lons, lats, True) ; 2 x nlatnlon</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">; loc = wrf_user_ll_to_ij(a, lons, lats, True) ; 2 x nlatnlon</font></div><div><font face="monospace">; loc = loc - 1 ; wrf_user_ll_to_ij returns 1-based indexes</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">;---Set up CSV file and header information for the file</font></div><div><font face="monospace"> csv_filename = "wrf_2m_temperature.csv"</font></div><div><font face="monospace"> system("rm -f " + csv_filename) ; Remove file in case it exists.</font></div><div><font face="monospace"> fields = (/"TIME", "LAT", "LON", "TEMPERATURE (degC)"/)</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">;---Create a header line for CSV file</font></div><div><font face="monospace"> dq = str_get_dq()</font></div><div><font face="monospace"> fields = dq + fields + dq ; Pre/append quotes to field names</font></div><div><font face="monospace"> header = [/str_join(fields,",")/] ; Header is field names separated</font></div><div><font face="monospace"> ; by commas.</font></div><div><font face="monospace">;</font></div><div><font face="monospace">; Format to use for writing each variable to CSV file.</font></div><div><font face="monospace">; If you don't want spaces in CSV file, use the following</font></div><div><font face="monospace">; format string:</font></div><div><font face="monospace">; format = "%s,%g,%g,%g"</font></div><div><font face="monospace">; </font></div><div><font face="monospace">format = "%s,%6.2f,%7.2f,%6.2f"</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">;</font></div><div><font face="monospace">; Loop through each time step and desired list of lat/lon values,</font></div><div><font face="monospace">; and write a single line of data to CSV file.</font></div><div><font face="monospace">;</font></div><div><font face="monospace"> write_table(csv_filename, "w", header, "%s") ; Write header to CSV file.</font></div><div><font face="monospace"> do it = 0,ntimes-1</font></div><div><font face="monospace"> do nl = 0,nlatlon-1</font></div><div><font face="monospace"> nln = loc(0,nl)</font></div><div><font face="monospace"> nlt = loc(1,nl)</font></div><div><font face="monospace"> lat1 = a[0]->XLAT(0,nlt,nln) ; nearest grid point</font></div><div><font face="monospace"> lon1 = a[0]->XLONG(0,nlt,nln)</font></div><div><font face="monospace"> alist = [/times(it),lat1,lon1,tk2(it,nlt,nln)/] ; Store data to be written in a list.</font></div><div><font face="monospace"> write_table(csv_filename, "a", alist, format) ; Write list to CSV file.</font></div><div><font face="monospace"> end do</font></div><div><font face="monospace"> end do</font></div><div><font face="monospace">end</font></div></div><div>-- <br></div><div dir="ltr" class="gmail-m_-2476126580448858229gmail-m_8622039739043775905gmail-m_391474934459665289gmail_signature">Borja Sas González</div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-2476126580448858229gmail-m_8622039739043775905gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br><br></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_-2476126580448858229gmail_signature">Borja Sas González</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br><br></div></div></div></div></div>