<div dir="ltr"><div> My script follows.. There were no problems. The output is attached.</div><div><br></div><div><a class="gmail_plusreply" id="m_-3639608746660769309plusReplyChip-1">++++++++++++++++++++++++++++++++++++++++++++++++++++</a></div><div><br></div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"<br><br> f = addfile("<a href="http://setareh_chem.nc">setareh_chem.nc</a>","r")<br> print(f) ; same as "nmcdump -h"<br><br> Times = f->Times ; [Time | 41] x [DateStrLen | 19] (character)<br><br>; For fun: Examine "Times" in different formats <br><br> Time_0 = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double)<br> ; Time_0 is recognized by cd_calendar<br> ;Time_1 = wrf_times_c( Times, 1 ) ; "hours since 1901-01-01 00:00:00" (double)<br> ;Time_2 = wrf_times_c( Times, 2 ) ; yyyymmddhhmnss (double)<br> Time_3 = wrf_times_c( Times, 3 ) ; yyyymmddhh (integer)<br><br> ;print(Times)<br> ;print(Time_0)<br> ;print(Time_1)<br> ;print(Time_2)<br> print(Time_3) ; easy on the eyes<br> print("------------------------------------")<br><br> a2 = f->TAUAER2 ; (Time, south_north, west_east)<br> a2&Time = Time_0 ; associate the 'Time' coordinate with the variable using standard NCL & syntax<br> printVarSummary(a2)<br> print("------------------------------------")<br><br> opt_cdv = True ; option for calculate_daily_values (cdv)<br> opt_cdv@nval_crit = 4 ; default is 1<br><br> a2Day = calculate_daily_values (a2, "avg", 0, opt_cdv)<br> printVarSummary(a2Day)<br> printMinMax (a2Day,1)<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 7, 2022 at 9:28 AM Setareh Rahimi <<a href="mailto:setareh.rahimi@gmail.com" target="_blank">setareh.rahimi@gmail.com</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 Dennis,</div><div>I sent you the file via<span style="background-color:rgb(217,210,233)"> <a href="http://transfer.pcloud.com" target="_blank">transfer.pcloud.com</a></span>. I could not send it here due to the large size of the file. </div><div>Please check the script with the file and let me know your idea.</div><div>Many thanks for your help.</div><div>Best wishes,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 7, 2022 at 3:18 PM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">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>I do not understand 'x' either</div><div><br></div><div><span style="background-color:rgb(213,166,189)"><span style="background-color:rgb(255,255,255)">"I wonder about variable x; I did not define such a variable."</span></span></div><div><br></div><div>ncl 0> f = addfile(".....","r") ; I do not have your file<br></div><div>ncl 1> print(f) ; like ncdump -h <br></div><div>ncl 2> Times = f->Times ; Times(Time, DateStrLen) (type character)</div><div>ncl 4> Time = wrf_times_c( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar</div><div>ncl 5> print(Time)</div><div><br></div><div>ncl 7> T = f->T <br>ncl 8> printVarSummary(T)</div><div><br></div><div>ncl 9> T&Time = Time ; associate time coordinate<br>ncl 10> printVarSummary(T)<br><br>Variable: T<br>Type: float<br>Total Size: 19683000 bytes<br> 4920750 values<br>Number of Dimensions: 4<br>Dimensions and sizes: [Time | ??] x [bottom_top | 27] x [south_north | 81] x [west_east | 90]<br>Coordinates: <br> Time: [ 0.. ?]<br>Number Of Attributes: 5<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : perturbation potential temperature (theta-t0)<br> units : K<br> stagger : <br>ncl 11> Tavg = calculate_daily_values (T, "avg", 0, True) <br>ncl 12> printVarSummary(Tavg) <br><br>Variable: Tavg<br>Type: float<br>Total Size: 1574640 bytes<br> 393660 values<br>Number of Dimensions: 4<br>Dimensions and sizes: [Time | ...] x [bottom_top | 27] x [south_north | 81] x [west_east | 90]<br>Coordinates: <br> Time: [ 0.. 12]<br>Number Of Attributes: 8<br> _FillValue : 9.96921e+36<br> FieldType : 104<br> MemoryOrder : XYZ<br> description : perturbation potential temperature (theta-t0)<br> units : K<br> stagger : <br> Time : 0<br> NCL_tag : calculate_daily_values</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 7, 2022 at 5:16 AM Setareh Rahimi <<a href="mailto:setareh.rahimi@gmail.com" target="_blank">setareh.rahimi@gmail.com</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 Dennis,</div><div>So many thanks for your advice. I made corrections to my script as you suggested, and attempted to calculate and plot the average AOD for 2011-06-28 but I still get errors. I attached the script and the errors. <br></div><div><br></div><div>As you can see from the error message, NCL says :<span style="background-color:rgb(255,229,153)">fatal: No coordinate variable exists for dimension (Time) in variable (x)</span></div><div><span style="background-color:rgb(213,166,189)"><span style="background-color:rgb(255,255,255)">I wonder about variable x; I did not define such a variable.</span><br></span></div><div><br></div><div>Please advise me on how to sort this issue out.</div><div>Many thanks in advance, <br></div><div>Best wishes,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 7, 2022 at 6:02 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">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>As noted in the documentation, <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml" target="_blank"><b>calculate_daily_values</b></a> requires that the variable have a **time coordinate** that is recognized by cd_calendar. <br><pre> Times = f->Times ; Times(Time, DateStrLen) (type character)
Time = <b>wrf_times_c</b>( Times, 0 ) ; "hours since" initial time on file (double); units recognized by cd_calendar</pre></div><div> a2 = f->TAUAER ; (Time, south_north, west_east)</div><div> a2&Time = Time ; associate the 'Time' coordinate with the variable using standard NCL & syntax<br></div><div> printVarSummary(a2)</div><div> print("------------------------------------") <br><pre> a2Day = calculate_daily_values (a2, "avg", 0, opt)
printVarSummary(a2Day)
printMinMax (a2Day,1)</pre></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 5, 2022 at 9:30 AM Setareh 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 NCL users,</div><div><br></div><div>I am trying to plot the daily average of AOD (aerosol optical depth) from WRF-chem outputs. However, I can not define the time so that NCL plots the daily average of AOD.(the script has been attached, and the model output is too large and I just used ncdump to show the header of some varibles ).<br></div><div>I tried the following commands:</div><div> <br></div><div><br></div><div><span style="background-color:rgb(255,229,153)">times = wrf_user_getvar(f,"times",-1)<br>printVarSummary(times)<br>print(times)<br>ymdh = cd_calendar(a2×, -2)<br> print(ymdh)</span></div><div><br></div><div>but faced an error.</div><div>Would you please kindly advise me on how can I calculate the daily average of AOD from the hourly output of WRF-chem?</div><div>Many thanks in advance,</div><div>Best wishes,<br></div><div>-- <br><div dir="ltr">S.Rahimi<br><br></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><br>
</blockquote></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">S.Rahimi<br><br></div>
</blockquote></div>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr">S.Rahimi<br><br></div>
</blockquote></div>