<div dir="ltr"><div>***Untested***<br></div><div><br></div><div>[1] Read the csv file and extract the year, month,day,hour,value into one-dimensional arrays: year(*),...val_units(*),val(*)</div><div>     Since each line in the csv file has integer, text and float values, it is best to read the values as strings and convert.<br></div><div>       <br><pre>   ncol = 6
   data = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/readAsciiTable.shtml"><strong>readAsciiTable</strong></a>("....", ncol, "string", 1)<br></pre><pre>   yyyy = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/toint.shtml"><b>toint</b></a>(data(:,0))<br>   mm   = toint(data(:,1))
        :<br>   val_unit = data(:,4)       ; string values<br>   val  = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/tofloat.shtml"><b>tofloat</b></a>(data(:,5))<br><br></pre><pre>; create required minute and second arrays<br></pre><pre>   nval = dimsizes(val)<br>   mn   = <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/new.shtml"><b>new</b></a> (nval,integer)<br>   sc   = new (nval,integer)<br></pre><pre>   mn   = 0<br>   sc   = 0
</pre></div><div>[2] Use <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/cd_inv_calendar.shtml"><b>cd_inv_calendar</b></a><b> <br></b></div><pre>    <br>; time units are arbitrary<br>    tunits = "hours since 2000-01-01 00:00:00" ; "seconds/hours/days since ...."
    time   = <strong>cd_inv_calendar</strong>(yyyy,mm,dd,hh,mn,sc,tunits, 0)
    time!0 = "time"
    <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><b>printVarSummary</b></a>(time)    ;  print(time)<br><br></pre><pre>    val!0= "time"<br>    val@units = val_unit(0)  ; assign scalar descriptor<br>    val&time  =  time<br>    <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/printVarSummary.shtml"><b>printVarSummary</b></a>(val)  <br>   <br></pre><pre>; calculate monthly mean values <br></pre><pre>    val_month  = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_monthly_values.shtml"><b>calculate_monthly_values</b></a>(val, "avg", 0, False)<br></pre><pre>    printVarSummary(val_month)<br></pre><pre>    <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/printMinMax.shtml"><b>printMinMax</b></a>(val_month, 1)</pre><pre><br><br></pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 3, 2023 at 11:03 AM MORICHETTI MAURO 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 class="msg-5865289516201810673">




<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255)">
</div>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
Hi all,<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
are there any chances to do a monthly average from hourly values csv file?<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
I have different files with the hourly values of temperature, wind-speed and relative humidity. I would like to calculate the monthly values, so I was thinking if there is a function in order to use the date reported in the file as coordinate for the meteorological
 values.<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
Attached part of the script and one some files as example.<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
If you need more information, ask me thanks.<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
<u></u> <u></u></p>
<p class="MsoNormal" style="margin:0cm;font-size:medium;font-family:Calibri,sans-serif;color:rgb(0,0,0)">
Mauro<u></u> <u></u></p>
<div><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><br>
</div></blockquote></div>