<div dir="ltr"><div><div><div><div><div>[1] <b>Big Picture</b><br><br></div>You are using <b>*one*</b> year of daily total precipitation to calculate a <b>*climatology*</b><br><br></div>By definition, a climatology is the average over some period of time. EG:  In your case, average ten years of  '1 July' values. That is the climatological mean value.<br><br></div>Even if the code you had written worked, the anomalies would all be 0.0.<br>Why? You are using only one year of data. The average of one value is the value itself. Hence, the difference is zero.<br></div><br></div>[2] <b>FIX</b><br><div><div><div><div><div><br></div><div>Use '<b>addfiles</b>' to read multiple years of APHRODITE daily files:<br>   <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>addfiles.shtml</a><br><br></div><div>We do not have APHRODITE files so the following is more of a guide.<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/clmDayTLL.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/clmDayTLL.shtml</a><br></div><div>Example 1 .... modified<br></div><div>===<br><br></div><div>   dirp = "./"     ; directory where APHRODITE files reside<br></div><div>   filp   = systemfunc("cd "+dirp+" ; ls APHRO_MA_025deg_V1101*nc")<br></div><div>   pthp = dirp + filp<br></div><div>   print(pthp)<br><br></div><div>   f      = <b>addfiles</b>(pthp, "r")<br></div><div>   pre  = f[:]->precip<br></div><div>   printVarSummary(pre)                ; time |? x [lat | ?] x [lon | ?] <pre> <span style="font-family:arial,helvetica,sans-serif"> time     = precip&time                      ; time:units = "days since ?-?-? 00:00:0.0"                               
   TIME   = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml" target="_blank"><b>cd_calendar</b></a>(time, 0)          
   year     = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/toint.shtml" target="_blank"><b>toint</b></a>( TIME(:,0) )               
   month  = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/toint.shtml" target="_blank"><b>toint</b></a>( TIME(:,1) )
   day      = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/toint.shtml" target="_blank"><b>toint</b></a>( TIME(:,2) ) 
                                                                
   yyyyddd = year*1000 + ddd                                    ; needed for input</span><br><br> pClmDay    = <strong>clmDayTLL</strong>(pre, yyyyddd) ; <b>daily climatology at each grid point </b>                                     
 <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><strong>printVarSummary</strong></a>(pClmDay)             ; [year_day | <b>366</b>] x [lat|?]x[lon|?]
                                      ; Coordinates: year_day: [<b>1..366]</b><br> pAnom      = <strong>calcDayAnomTLL</strong> (pre, yyyyddd, pClmDay)     
 <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><strong>printVarSummary</strong></a>(pAnom_sm)
 <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml"><strong>printMinMax</strong></a>(pAnom, 0)<br><br></pre><pre>; <b>*NOW*</b> extract the daily anomalies from 'pAnom' for the days of interest<br><br>  smdStrt= 19880713<br>  smdLast= 19880718<br></pre><pre><b>                                        ; opttonal </b><br>;pClmDay_sm = <strong>smthClmDayTLL</strong>(pClmDay, 3) ; you would have to experiment with 'nhar' 
<strong>;</strong><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><strong>printVarSummary</strong></a>(pClmDay_sm)<br><br><br>;pAnom_sm   = <strong>calcDayAnomTLL</strong> (pre, yyyyddd, pClmDay_sm)     
;pAnom_sm@long_name = "Anomalies from Smooth Daily Climatology"
 <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><strong>printVarSummary</strong></a>(pAnom_sm)
 <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml"><strong>printMinMax</strong></a>(pAnom_sm, 0)
  </pre></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 31, 2018 at 11:09 AM, Nabeela Sadaf <span dir="ltr"><<a href="mailto:nh16@mails.tsinghua.edu.cn" target="_blank">nh16@mails.tsinghua.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><br><blockquote class="m_5829982795567167287ReferenceQuote" style="padding-left:5px;margin-left:5px;border-left:#b6b6b6 2px solid;margin-right:0">
-----Original Messages-----<br>
<b>From:</b><span id="m_5829982795567167287rc_from">"Nabeela Sadaf" <<a href="mailto:nh16@mails.tsinghua.edu.cn" target="_blank">nh16@mails.tsinghua.edu.cn</a>></span><br>
<b>Sent Time:</b><span id="m_5829982795567167287rc_senttime">2018-06-01 01:01:07 (Friday)</span><br>
<b>To:</b> <a href="mailto:ncl-talk-request@ucar.edu" target="_blank">ncl-talk-request@ucar.edu</a><br>
<b>Cc:</b> <br>
<b>Subject:</b> Daily anomaly from monthly climatology<br><br>









<p class="MsoNormal"><span style="font-family:"Times New Roman"">Hi<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman""><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman"">I am using
Aphrodite daily data to calculate anomaly of an event i.e. 13July1988 to 18July1988
with respect to climatology of JJA during 1988.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman""><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman"">In first step, I
selected JJA i.e. 92 time-steps from 1<sup>st</sup> june till 31<sup>st</sup>
August 1988.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman"">Print(ddd)<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman""><u></u> <u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Variable: ddd<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Type: integer<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Total Size: 368 bytes<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>92 values<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Number of Dimensions: 1<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Dimensions and sizes:<span>  </span>[92]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Coordinates: <u></u><u></u></span></p>

<p class="m_5829982795567167287MsoListParagraphCxSpFirst" style="margin-left:74.0pt;text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>(0)<span style="font:7.0pt "Times New Roman"">           
</span></span></span><span style="font-family:"Times New Roman";color:black">153<u></u><u></u></span></p>

<p class="m_5829982795567167287MsoListParagraphCxSpLast" style="margin-left:74.0pt;text-autospace:none"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">(91)<span>     </span>244<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">In
the second step, I defined event days.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">Print(sddd)<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Variable: sddd<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Type: integer<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Total Size: 24 bytes<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>    </span><span>        </span>6 values<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Number of Dimensions: 1<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Dimensions and sizes:<span>  </span>[6]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Coordinates: <u></u><u></u></span></p>

<p class="m_5829982795567167287MsoListParagraph" style="margin-left:74.0pt;text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>(0)<span style="font:7.0pt "Times New Roman"">           
</span></span></span><span style="font-family:"Times New Roman";color:black">195<u></u><u></u></span></p>

<p class="MsoNormal" style="margin-left:18.0pt;text-autospace:none"><span style="font-family:"Times New Roman";color:black">(5)<span>   </span>200<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">while
printVarSummary(pre) gives<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Variable: pre<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Type: float<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Total Size: 37094400 bytes<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>9273600 values<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Number of Dimensions: 3<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Dimensions and sizes:<span>  </span>[time
| 92] x [latitude | 280] x [longitude | 360]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Coordinates: <u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>time: [ 153..
244]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>latitude:
[-14.875..54.875]<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><span>            </span>longitude: [60.125..149.875]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">PrintVarSummary(xClmDay)<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Variable: xClmDay<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Type: float<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Total Size: 147571200 bytes<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>36892800 values<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Number of Dimensions: 3<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Dimensions and sizes:<span>  </span>[year_day
| 366] x [latitude | 280] x [longitude | 360]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">Coordinates: <u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>year_day:
[1..366]<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><span>            </span>latitude:
[-14.875..54.875]<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><span>            </span>longitude: [60.125..149.875]<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">so
when I try calcDayAnomTLL it gives following error<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">fatal: Subscript out of range, error in subscript #0<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">fatal: An error occurred reading days<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black">fatal:["Execute.c":8575]:<wbr>Execute: Error occurred at or
near line 4562 in file $NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.ncl<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">fatal:["Execute.c":8575]:<wbr>Execute:
Error occurred at or near line 87 in file P2.ncl<u></u><u></u></span></p>

<p class="MsoNormal" style="text-autospace:none"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">Although
time format is same in all variables but it gives error in subscript number 0.<u></u><u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><u></u> <u></u></span></p>

<p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">Can
anyone help me? Thanks in advance.<br>Attached herewith is the script.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Times New Roman";color:black"><br></span></p><p class="MsoNormal"><span style="font-family:"Times New Roman";color:black">Nabeela</span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Courier;color:black"><u></u> <u></u></span></p>

</blockquote><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>