<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>