<div dir="ltr"><div><b>NCL: <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_monthly_values.shtml">calculate_monthly_values</a><br></b></div><div>----<br></div><div><b>T</b>he CDO has a <b>monmean </b>operator but I am not sure how to extract 6-hrly subsets.<br></div><div><b></b></div><div><b>CDO:</b> <a href="https://code.mpimet.mpg.de/projects/cdo" target="_blank">https://code.mpimet.mpg.de/projects/cdo</a></div><div>----</div><div>NCL:</div><div><br></div><div>   f  Â  = addfile("...nc", "r")<br>  Â x Â  = f>X<br>  Â printVarSummary(x) Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â ; [time | ...] x [lat | ...] x [lon | ...]</div><div>                                                           ; [time | ...] x [lev |...] x [lat | ...] x [lon | ...]</div><div><br></div><div>   time = x&time                                  ; "seconds/minutes/days since ..."</div><div>   TIME Â  = <b>cd_calendar</b>(time, 0) Â  Â  Â  Â  Â  Â  ; type float <br>  Â year Â Â  = toint( TIME(:,0) ) Â  Â  Â  Â  Â  Â  Â  ; toint strips meta data<br>  Â month = toint( TIME(:,1) )<br>  Â day Â  Â  = toint( TIME(:,2) ) Â  Â  Â  Â  Â  Â  Â  ; day of month <br>  Â hour Â  = toint( TIME(:,3) ) Â  Â  Â  Â  Â  Â  Â  ; hour of day</div><div><br></div><div>;  x(time,lat,lon)</div><div> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  <br></div><div>   do hh=0,18,6</div><div>        ihr Â := ind(hour.eq.hh) Â  Â  Â ; indices</div><div>        if (hh.eq.0) then</div><div>   Â  Â  Â  Â  x00 = <b>calculate_monthly_values</b>(x(ihr,:,:), "avg", 0, False)    <br>  Â  Â  Â  Â Â  x00@long_name = "00Z: Monthly Mean: "+x00@long_name<br>  Â  Â  Â  Â Â  printVarSummary(x00)<br></div><div><br> </div><div>  Â Â Â Â Â  elseif (hh.eq. 6) then<br>  Â  Â  Â  Â  x06 = calculate_monthly_values(x(ihr,:,:), "avg", 0, False)<br>  Â  Â  Â  Â  x06@long_name = "06Z: Monthly Mean: "+x06@long_name<br>  Â  Â  Â  Â  printVarSummary(x06)<br><br>  Â  Â  elseif (hh.eq.12) then<br>  Â  Â  Â  Â  x12 = calculate_monthly_values(x(ihr,:,:), "avg", 0, False)<br>  Â  Â  Â  Â  x12@long_name = "12Z: Monthly Mean: "+x12@long_name<br>  Â  Â  Â  Â  printVarSummary(x12)<br><br>  Â  Â  elseif (hh.eq.18) then<br>  Â  Â  Â  Â  x18 = calculate_monthly_values(x(ihr,:,:), "avg", 0, False)<br>  Â  Â  Â  Â  x18@long_name = "18Z: Monthly Mean: "+x18@long_name<br>  Â  Â  Â  Â  printVarSummary(x18)<br>  Â  Â  end if<br>  Â  Â  print("------------------------------------------------")<br>  Â end do</div><div><br></div><div>Make appropriate changes for X being other dimension ranks<br></div><div><br></div><div>X(time) => x(ihr)</div><div>X(time,pts) => x(ihr,:)</div><div>X(time,lat,lon) => x(ihr,:,:)</div><div>X(time,lev,lat,lon) => x(ihr,:,:,:)</div><div><br></div><div>Good luck<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Aug 11, 2019 at 1:52 PM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@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">Dear all,<div><br></div><div>I have a nc file for my study area, containing hourly values for 6 months at <span style="background-color:rgb(217,210,233)">00, 06, 12, 18.</span> What I am looking for is to have an average for each month over each mentioned time, like :</div><div> April average at 00, 06, 12, 18.</div><div><br></div><div>How can I do this? Is there any function doing this, please?</div><div>Thanks for your advice in advance,</div><div>Best wishes,<br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail-m_180681067769693652gmail-m_-4264337966189119083gmail_signature">S.Rahimi<br><br></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailman/listinfo/ncl-talk</a></blockquote></div>