<div dir="ltr">Dear Dave & Dennis,<div>I profoundly appreciate the time you consider to respond to this issue. Following your advice, I calculated the anomaly of my study period (attached)</div><div>. I just want to check with you to make sure that my calculation is correct.</div><div>--------------------------------------------------------------------------------------------------------------------</div><div> ymStrt = 196901                              ; climatology period <br> ymLast = 200012<br>---------------------------------------------------------------------------------------------------------------------<br> ymStrt1 = 200001                            ; study period that I need to calculate anomaly for </div><div> </div><div class="gmail_chip gmail_drive_chip" style="width:396px;height:18px;max-height:18px;background-color:rgb(245,245,245);padding:5px;font-family:arial;font-weight:bold;font-size:13px;border:1px solid rgb(221,221,221);line-height:1"><a href="https://drive.google.com/file/d/1q6cOTIxpaphuvmC2snsizhUEq5MRL8lQ/view?usp=drive_web" target="_blank" style="display:inline-block;max-width:366px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration-line:none;padding:1px 0px;border:none"><img style="vertical-align: bottom; border: none;" src="https://ssl.gstatic.com/docs/doclist/images/icon_10_generic_list.png"> <span dir="ltr" style="vertical-align:bottom;text-decoration:none">air.mon.mean.nc</span></a><img src="//ssl.gstatic.com/ui/v1/icons/common/x_8px.png" style="opacity: 0.55; cursor: pointer; float: right; position: relative; top: -1px; display: none;"></div><div>ymLast1 = 200512</div><div>----------------------------------------------------------------------------------------------------------------------</div><div>Many thanks in advance,</div><div>Kind regards,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, May 30, 2021 at 5:46 AM Dennis Shea <<a href="mailto:shea@ucar.edu">shea@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>Dave's analysis is correct.</div><div><br></div><div>This was amongst the earliest functions added to NCL [?late 199[7/8/9] ?]</div><div><br></div><div>It is the user's responsibility to examine the file(s). The example uses;</div><div><pre>  air  = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml" target="_blank"><strong>short2flt</strong></a>( fa->air)                           ; air temp        
  nobs = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml" target="_blank"><strong>short2flt</strong></a>( fb->air)                           ; # obs for air</pre></div><div> because the data were of type <b>short </b>. They must be unpacked before usage.</div><div><b></b>---<br></div><div>The function requires the user to input a reference climatology as the 2nd argument.</div><div><br></div><div><pre>function calcMonAnomTLL (
                x     [*][*][*] : float or double,  
                xAve [12][*][*] : numeric  )         </pre></div><div>Why?  Many papers/organizations used 1950-79 as a reference SST period. <br></div><div>Hence, we allowed the user to independently calculate the desired reference climatology. [xAve]</div><div>This also allowed the reference period to be calculated from a different SST.<br></div><div><br></div><div>Also, I think the data started in 1800. The 'moStrt' and 'moLast' were the index values for the start and end of the period to be used.<br></div><div><br></div><div>Many other example use this function:<br></div><div><br></div>eof_3.ncl                          <a href="http://www.ncl.ucar.edu/Applications/eof.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Applications/eof.shtml</b></a><br>eof_3_640.ncl<br>eof_4_640.ncl<br>godas_3.ncl                     <a href="http://www.ncl.ucar.edu/Applications/godas.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Applications/godas.shtml</b></a><br>index_amo_1.ncl             <a href="http://www.ncl.ucar.edu/Applications/indices.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Applications/indices.shtml</b></a><br>indices_nino_1.ncl          <a href="http://www.ncl.ucar.edu/Applications/indices.shtml" target="_blank"><b> http://www.ncl.ucar.edu/Applications/indices.shtml</b></a><br>indices_oni_1.ncl<br><div><a href="http://indices_oni_2.nc" target="_blank">indices_oni_2.nc</a></div><div><br></div><div>Other examples: <br></div><div>bootstrap_correl_2.ncl       <a href="http://www.ncl.ucar.edu/Applications/bootstrap.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Applications/bootstrap.shtml</b></a><br>coads_3.ncl                       <a href="http://www.ncl.ucar.edu/Applications/coads.shtm" target="_blank"><b>http://www.ncl.ucar.edu/Applications/coads.shtm</b></a>l</div>prn_osc_pat_1.ncl             <a href="http://www.ncl.ucar.edu/Applications/prn_osc_pat.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Applications/prn_osc_pat.shtml</b></a></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 28, 2021 at 11:53 AM Dave Allured - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.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>There is a bit of missing information in the example.  I think the expectation is that you are supposed to get copies of the input files, examine their metadata, and figure out some of these things as an educational exercise.  But I agree that it is a bit mysterious.  This is what I deduce from reading the example and documentation, and being familiar with common structures in climate data.</div><div><br></div><div>* Dimensions of the two main input file variables are (time, lat, lon).</div><div>* The input files are a series of monthly grids in chronological order, 12 monthly grids for each year in the file.</div><div>* The input months are stacked on a single time dimension, so that December of one year is immediately followed by January of the next year.</div><div>* The first month in the input files is January 1800.</div><div><br></div><div>The example computes monthly anomalies for a 30-year time range, and NOT starting at the beginning of the files.  Therefore, integer subscripts for the first and last time steps in the requested time range are needed.  Subtract 1800 to get the year offset from the start of the file, to the start of the requested anomaly period.  Then multiply by 12 to convert from integer year offsets, to integer month offsets.</div><div><br></div><div>As briefly noted in the comments, moStrt and moLast are the first and last integer subscripts to access all 12 months of the requested time range, 1950 through 1979.  In particular, that is January of the first year, through December of the last year.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 28, 2021 at 11:16 AM setare rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.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>Dear all NCL users,<br><br></div><div>I visited this link:<span style="background-color:rgb(255,242,204)"> <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/calcMonAnomTLL.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/calcMonAnomTLL.shtml</a> </span>, which is about monthly anomalies. But I could not understand the way it calculates the anomalies. <span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px"></span></div><p style="font-variant-numeric:normal;font-variant-east-asian:normal;margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt"></p><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">_____________________________________________________________________________________________</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">Example 1</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">  fa     = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">addfile</strong></a>("<a href="http://air.mean.nc/" target="_blank">air.mean.nc</a>","r")
  fb     = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">addfile</strong></a>("<a href="http://air.nobs.nc/" target="_blank">air.nobs.nc</a>","r")
 
  air  = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">short2flt</strong></a>( fa->air)                           ; air temp        
  nobs = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">short2flt</strong></a>( fb->air)                           ; # obs for air
; filter out geographic locations that have < nMin observations
  nMin   = 2                                           ; min # obs
  air    = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/mask.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">mask</strong></a>(air,nobs.ge.nMin,True)

;---Compute the climatology using a function in contributed.ncl
  yrStrt = 1950
  yrLast = 1979
  moStrt = <span style="background-color:rgb(217,210,233)">(yrStrt-1800)*12     </span>         ; start subscript
  moLast = (yrLast-1800)*12 + 11         ; last  subscript
  clm = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/clmMonTLL.shtml" style="color:rgb(0,64,255);margin:0px;padding:0px;text-decoration-line:none;font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">clmMonTLL</strong></a> (air(moStrt:moLast,:,:)) ; monthly climatology

;---Compute the anomalies from the climatology just computed
  xAnom = <strong style="margin:0px;padding:0px">calcMonAnomTLL</strong> (air,clm)</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)">_________________________________________________________________</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;line-height:12pt;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, sans-serif">May I ask you please explain subscript method? Why using 1800 and then multiply 12?</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;line-height:12pt;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, sans-serif">what do moStrt and moLast show?</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;line-height:12pt;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, sans-serif">I appriciate any advse</font></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px;padding:0px;line-height:12pt;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"><font face="arial, sans-serif">All the best,</font></pre></div></blockquote></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>
</blockquote></div>