<div dir="ltr"><div><b>2019081503</b> is of the form yyyymmddhh</div><div>===</div><div><a href="http://www.ncl.ucar.edu/Document/Functions/"><b>http://www.ncl.ucar.edu/Document/Functions/</b></a></div><div><br></div><div>Click "<b>Date</b>"</div><div><br></div><div>You will see a large number of 'time/date' related functions.</div><div><br></div><div>The <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml"><b>cd_inv_calendar</b></a> function can take yyyy, mm, dd, hh and convert to a common reference time.</div><div><br></div><div>  yyyymmddhh = 2019081503</div><div><br></div><div>  yyyy = yyyymmddhh/1000000<br>  mdh  = yyyymmddhh%1000000<br>  mm   = mdh/10000<br>  dh     = mdh%10000<br>  dd     = dh/100<br>  hh     = dh-dd*100</div><div><br></div><div>                                 ; create arrays [*] of required size
</div><div><pre>  mn    = dd     ;create array same size as dd
  sc    = dd                                 
  mn    = 0      set arrays to 0
  sc    = 0
                                              ; user specified
  units  = "hours since 1900-01-01 00:00:00" ; "seconds/hours/days since ...."
                                             ; do <b>NOT</b> use "months since ...."

  time   = <strong>cd_inv_calendar</strong>(yyyy,mm,dd,hh,mn,sc,units, 0)
  time!0 = "time"
  <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml"><strong>print</strong></a>(time)<br><br></pre><pre>  yyyymm   = yyyy*100 + mm<br>  yyyymmdd = yyyymm*100 + dd<br>  yyyyddd  = <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/yyyymmdd_to_yyyyddd.shtml"><strong>yyyymmdd_to_yyyyddd</strong></a>( yyyymmdd )<br><br></pre><pre>Now you have time information in different formats. These can be used as input to NCL's climatological functions:<br><br><a href="http://www.ncl.ucar.edu/Document/Functions/climo.shtml"><b>http://www.ncl.ucar.edu/Document/Functions/climo.shtml</b></a><br><br><b> </b></pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 23, 2021 at 8:24 PM Jayant 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:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi! I am reading binary files and extracting date from the file name (GFCT<b>2019081503</b>.out) and creating the time dimension:</div><div><span style="font-family:monospace"> tim=new(ntim,integer)<br> tim!0         = "time"<br> tim@long_name = "time"<br> tim@units     = "hours"<br> tim&time      = tim<br></span></div><div>my time dimension is an integer array (yyyymmddhh) :</div><div><span style="font-family:monospace">  2019081503</span></div><div><span style="font-family:monospace">  2019081506</span></div><div><span style="font-family:monospace">  2019081509</span></div><div><span style="font-family:monospace">  ...</span></div><div><span style="font-family:monospace">  2019093012</span><br></div><div>Is it possible to convert it to calendar time so as to perform daily/weekly/monthly/seasonal average? How can it be done?</div><div>Please advise.<br></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>