<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Thank you so much for your help.</p>
<p><br>
</p>
<p>Best,</p>
<p><br>
</p>
<p>Jade</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Bill Ladwig &lt;ladwig@ucar.edu&gt;<br>
<b>Sent:</b> Friday, June 24, 2016 2:05:18 PM<br>
<b>To:</b> Wang,Yu<br>
<b>Cc:</b> NCL<br>
<b>Subject:</b> Re: [ncl-talk] NCL wrf_contour use for multiple files</font>
<div>&nbsp;</div>
</div>
<div>
<div dir="ltr">Hi Jade,
<div><br>
</div>
<div>Attached is an updated version of the NCL script.&nbsp; Using NCL 6.4.0, it was actually crashing while doing the calculation, before it got to the wrf_contour line, so I'm not sure why you weren't seeing that crash as well.&nbsp; After fixing that error, I got
 the error that you reported.&nbsp; Here's what happened:</div>
<div><br>
</div>
<div>For the first crash, you have a total of 24 times, but you actually need 25 times (missing the 2005-08-25_12:00:00 time) in order to calculate the final hour.&nbsp; You might want to redo the model run to include this time if you need that final hour, because
 otherwise that final hour needs to be excluded since you have nothing to subtract from.&nbsp; We needed to adjust the end of the calculation to not jump over the array bounds in the calculation.&nbsp;</div>
<div><br>
</div>
<div>The second problem, with the list index out of bounds error for 'a[it]' is due to the script expecting one file per list index.&nbsp; This isn't the case for your data.&nbsp; You only have 2 data files, so you only need to increment the data file index at a time
 index of 12.&nbsp; The correction is the use a[it/times_per_file] or a[it/12].</div>
<div><br>
</div>
<div>Hope this helps,</div>
<div><br>
</div>
<div>Bill &nbsp; &nbsp;</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jun 15, 2016 at 10:57 AM, Bill Ladwig <span dir="ltr">
&lt;<a href="mailto:ladwig@ucar.edu" target="_blank">ladwig@ucar.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi Jade,
<div><br>
</div>
<div>Are you able to send me the two data files and your copy of the NCL script?&nbsp; I'm not seeing why this isn't working for you, or why it's failing where it's failing.&nbsp; Based on the script and the text in your original post, it's failing after it prints 2005-08-25_05:00:00,
 which would indicate it's still working on the first file, since it would have printed 2005-08-25_06:00:00 when it started the second file. &nbsp;</div>
<div><br>
</div>
<div>
<div style="font-size:12.8px">Here are the instructions for FTPing the files (taken from&nbsp;<a href="http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP" target="_blank">http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP</a>):</div>
<div style="font-size:12.8px"><br>
</div>
<div style="font-size:12.8px">
<p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">
<b style="margin:0px;padding:0px">You can ftp larger datasets and files to:</b></p>
<p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">
</p>
<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:16px;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">ftp <a href="http://ftp.cgd.ucar.edu/" target="_blank">ftp.cgd.ucar.edu</a>
anonymous
&lt;use your email address for the password&gt;
cd incoming
put ...
put ...



quit
</pre>
<p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">
<font color="red" style="margin:0px;padding:0px">Note that for security reasons, you cannot list the contents of this directory, and neither can we. We need to know the&nbsp;<i style="margin:0px;padding:0px">exact</i>&nbsp;names of the files in order to retrieve them.</font></p>
<p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:16px">
<br>
</p>
<p style="margin:10px 0px 20px;padding:0px;font-size:13.3333px;line-height:16px">
<font color="#000000" face="arial, helvetica, sans-serif">After the file is uploaded, you can send a message directly to me with the filename (or reply to ncl-talk if you wish).&nbsp; From there, we can try to get you a fix for your problem.</font></p>
<p style="margin:10px 0px 20px;padding:0px;font-size:13.3333px;line-height:16px">
Thanks,</p>
<p style="margin:10px 0px 20px;padding:0px;font-size:13.3333px;line-height:16px">
Bill</p>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jun 15, 2016 at 10:04 AM, Wang,Yu <span dir="ltr">
&lt;<a href="mailto:wangyu8722@ufl.edu" target="_blank">wangyu8722@ufl.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
Hi Bill,
<div><br>
</div>
<div>Thank you so much for your suggestion. Here are some of the screenshot of my file.</div>
<div>First I have addfiles of these two files:</div>
<div><img size="13336" style="max-width:99.9%" src="cid:37031a61-6b37-45b5-96d6-420ea4f1ab68"><br>
</div>
<div>Then I printed all times:</div>
<div><img size="17328" style="max-width:99.9%" src="cid:ef05eaba-261d-4e70-a95d-15d217a6633a"><br>
</div>
<div><img size="39207" style="max-width:99.9%" src="cid:403a76c4-5318-4235-84e0-0f48bd2cfde8"><br>
</div>
<div>My loop looks like below:</div>
<div><img size="42491" style="max-width:99.9%" src="cid:5ae5fc2d-46df-485c-a2a6-4fb1721a6fc5"><br>
</div>
<div>And here is the ncdump -h results:</div>
<div><img size="21984" style="max-width:99.9%" src="cid:bc85c89e-a66d-48f8-8fc8-f669a4d2c82e"><br>
</div>
<div>I think the error&nbsp;(out of range) I get is at line from the loop:</div>
<div>&gt;&nbsp;<span>contour_psl = wrf_contour(a[it],wks,slp(it,:,:),opts_psl) when it = 12</span></div>
<div><span><br>
</span></div>
<div>Hope this information can help me better solve this problem. Thank you so much for all your help.</div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>Jade</div>
<div><span><br>
</span></div>
<div><span><br>
</span></div>
<div><br>
</div>
</div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Bill Ladwig &lt;<a href="mailto:ladwig@ucar.edu" target="_blank">ladwig@ucar.edu</a>&gt;<br>
<b>Sent:</b> Wednesday, June 15, 2016 11:36:37 AM<br>
<b>To:</b> Wang,Yu; NCL
<div>
<div><br>
<b>Subject:</b> Re: [ncl-talk] NCL wrf_contour use for multiple files</div>
</div>
</font>
<div>&nbsp;</div>
</div>
<div>
<div>
<div>
<div dir="ltr">Hi Jade,
<div><br>
</div>
<div>Please include ncl-talk in your replies so that it posts to the email list.&nbsp; The error you're getting is most likely due to 'it' being out of the bounds for your 'a' list variable.&nbsp; This leads me to believe there aren't actually 12 timesteps in that second
 file.&nbsp; Have you looked at the file?&nbsp; Never assume it's what you think it is, always check.&nbsp; Please do an 'ncdump -h wrfout_d01_2005-08-25_06:00:00' and report back the result.&nbsp; Until I know what's really in that second file, it's hard to guess what might be
 going wrong.&nbsp; Also, if you can print the 'times' result from 'times = wrf_user_getvar(a, &quot;times&quot;, -1)', that would be helpful too.</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Bill</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Jun 14, 2016 at 6:29 PM, Wang,Yu <span dir="ltr">
&lt;<a href="mailto:wangyu8722@ufl.edu" target="_blank">wangyu8722@ufl.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thank you so much for your help.&nbsp;</p>
<p><br>
</p>
<p>I think I will put my question in a different way maybe it is more clear.</p>
<p><br>
</p>
<p>I have two&nbsp;nc files wrfout_d01_<font face="Calibri, Arial, Helvetica, sans-serif">2005-08-25_00:00:00 and&nbsp;</font><span style="font-family:Calibri,Arial,Helvetica,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;,NotoColorEmoji,&quot;Segoe UI Symbol&quot;,&quot;Android Emoji&quot;,EmojiSymbols;font-size:16px">wrfout_d01_</span><font face="Calibri, Arial, Helvetica, sans-serif">2005-08-25_06:00:00,
 each of them have 12 time steps, whic means they have 30 minutes interval. I put them together using a addfiles command. And using a timestep of 2 to loop over to calculate the hourly precipitation tendency by using a later time minus an&nbsp;earlier&nbsp;one, for example,
 using the 5th time step&nbsp;(<span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">2005-08-25_02:00:00</span>) of the first file minus the 3rd time step&nbsp;(<span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">2005-08-25_01:00:00</span>)
 to calculate the tendency between 01Z to 02Z.&nbsp;</font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><br>
</font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif">When I was trying to plot the tendency from 2005-08-25_05:00:00&nbsp;(which is the 11th time&nbsp;step of the first file as well as the 11th of the addfiles resulted list) to&nbsp;<span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">2005-08-25_06:00:00(which
 is the 3rd time step of the second file, and the 13th time step of the addfiles list) using the line below:&nbsp;</span></font></p>
<pre style="word-wrap:break-word;white-space:pre-wrap">&gt; contour_psl = wrf_contour(a[it],wks,slp(it,:,:),opts_psl)</pre>
And get the error of&nbsp;<span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">fatal:ListSelect: Index out of range.</span>
<p></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">If this still does not make any sense. Could you give
 me some suggestion about how to use wrf_contour to plot the difference between the last time&nbsp;step of one wrf output file and the first time step of the second file? Can it be done or I have to use some other functions.</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Hope this explain better of my question.&nbsp;</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Thanks again for your help.</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Best,</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><br>
</span></span></font></p>
<p><font face="Calibri, Arial, Helvetica, sans-serif"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px"><span style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">Jade</span></span></font></p>
</div>
<hr style="display:inline-block;width:98%">
<div dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Bill Ladwig &lt;<a href="mailto:ladwig@ucar.edu" target="_blank">ladwig@ucar.edu</a>&gt;<br>
<b>Sent:</b> Tuesday, June 14, 2016 6:21:11 PM<br>
<b>To:</b> Wang,Yu<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>;
<a href="mailto:wrfhelp@ucar.edu" target="_blank">wrfhelp@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] NCL wrf_contour use for multiple files</font>
<div>&nbsp;</div>
</div>
<div>
<div>
<div>
<div dir="ltr">Hi Jade,<br>
<div><br>
</div>
<div>Can you do an &quot;ncdump -h wrf_file&quot; or an ncl_filedump and report back the number of times for each file?&nbsp; With WRF, sometimes the last file has less times than the other files.&nbsp; In this case, it might be only 1.&nbsp; With a tend_int greater than 1, you might
 be jumping past the last time.&nbsp; Without seeing the data, it's hard to say.</div>
<div><br>
</div>
<div>Bill</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Jun 14, 2016 at 2:53 PM, Wang,Yu <span dir="ltr">
&lt;<a href="mailto:wangyu8722@ufl.edu" target="_blank">wangyu8722@ufl.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p></p>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Dear ncl_talk and wrfhelp,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
Hope everything goes well with everyone.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
I am having a problem with ncl when I wanted to plot hourly&nbsp;precipitation tendencies multiple files. I used the example from the wrf website as below&nbsp;</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
<a href="http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/PRECIP/wrf_Precip_multi_files.ncl" title="http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/PRECIP/wrf_Precip_multi_files.ncl
Ctrl&#43;Click or tap to follow the link" target="_blank">http://www2.mmm.ucar.edu/wrf/OnLineTutorial/Graphics/NCL/Examples/PRECIP/wrf_Precip_multi_files.ncl</a>.
 All I did is to change the input file. I have 2 domain 1 files, including 6&nbsp;hours with 30 mins interval in each file. The script works perfectly when it was processing the first file as below:</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;margin-top:0px;margin-bottom:0px">
&nbsp;</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">(0) &nbsp; &nbsp; Working on time: 2005-08-25_01:00:00</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">(0) &nbsp; &nbsp; Working on time: 2005-08-25_02:00:00</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">(0) &nbsp; &nbsp; Working on time: 2005-08-25_03:00:00</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">(0) &nbsp; &nbsp; Working on time: 2005-08-25_04:00:00</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">(0) &nbsp; &nbsp; Working on time: 2005-08-25_05:00:00</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">But when it get to calculate the next hour which should use both files, the script starts to have trouble and give me an error of&nbsp;
<div>fatal:ListSelect: Index out of range</div>
<div>fatal:[&quot;Execute.c&quot;:8575]:Execute: Error occurred at or near line 89 in file wrf_Precip_multi_files.ncl</div>
<div>Is this because of my output file or there is something I should change in the script?</div>
<div><br>
</div>
<div>Hope some one can provide some help. I would really appreciate any help. Thank you so much.</div>
<div><br>
</div>
<div>Best,</div>
<div><br>
</div>
<div>Jade</div>
</div>
<br>
<p></p>
</div>
</div>
<br>
_______________________________________________<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><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>