<div dir="ltr"><div>Your code structure is:</div><div><br></div><div><pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:14px">do nt=0,ntim-1
   ... (rainTot(nt,:,:) - rainTot(nt-1,:,:)),res)</pre><pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);font-size:14px">end do</pre></div><div><br></div><div>So on the first iteration, nt = 0, and nt-1 = -1.  That is a subscript out of bounds.  What do you really want to compute here when nt=0?  Do you want to skip this iteration?</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 10, 2023 at 7:57 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear all,<div><br></div><div>I need to calculate <span style="background-color:rgb(255,255,255)"><font color="#9900ff"><b>hourly precipitation</b> </font></span>from WRF-Chem output files. In order, to do this I used the below equation:</div><div><span style="background-color:rgb(255,217,102)">(rainTot(nt,:,:) - rainTot(nt-1,:,:))</span><br></div><div><span style="background-color:rgb(255,217,102)"><br></span></div><div><span style="background-color:rgb(255,255,255)">However, I received these error messages: </span></div><div>





<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(180,167,214)">fatal:Subscript out of range, error in subscript #0</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(180,167,214)">fatal:An error occurred reading rainTot</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures;background-color:rgb(180,167,214)">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 70 in file precip</span></p></div><div><div><br></div><div>Would you please advise me on how to remove these error messages? (the script is attached).</div><div><br></div><div>I have also another question, how can I calculate the <font color="#9900ff">daily average precipitation,</font> please?</div><div><br></div><div>Many thanks in advance.</div><div><br></div><div>Best wishes,</div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">S.Rahimi</div></div></div>
</blockquote></div></div>