<div dir="ltr"><div dir="ltr">Hi Dennis,<div><br></div><div>Thanks for your prompt reply.</div><div><br></div><div>Yes, your suggestions fixed the problem; adding dim_avg_n_Wrap.ncl to the .../csm folder and loading it at the beginning of the function.</div><div><br></div><div>Many thanks,</div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">Li-Hao</font><br></div></div></div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 7, 2021 at 11:44 PM Dennis Shea <<a href="mailto:shea@ucar.edu">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>The <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml" target="_blank"><b>dim_avg_n_Wrap</b></a> should be in the <b>contributed.ncl</b> library.</div><div>---</div><div>I have attached the function. You can explicitly load this function <br></div><div><br></div><div>load "dim_avg_n_Wrap"</div><div><br></div><div>You can add the path to where the function resides if not in the same directory as your script.</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 7, 2021 at 7:39 AM Li-Hao Young 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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi All at NCL-talk:<div><br></div><div>My research requires me to obtain the standard deviation of wind direction. And this has led me to NCL's wind_stats function. Therefore, I have installed NCL 6.6.2 on my Mac Mojave (which took me many many hours...). However, while running the Example 1 codes of wind_stats from <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_stats.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_stats.shtml</a>, I was stopped by a fatal error message and could not continue on with that example. The example codes are given at the bottom; the error occurred while executing "x := <strong style="margin:0px;padding:0px">wind_stats</strong>(wspd, wdir, 0, False)" as follow:</div><div><br></div><div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">ncl 6> x := wind_stats(wspd, wdir, 0, False) ; variable of type 'list'</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (dim_avg_n_Wrap) is undefined, can't continue</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 1442 in file /usr/local/ncl-6.6.2/lib/ncarg/nclscripts/csm/contributed.ncl</span></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8635]:Execute: Error occurred at or near line 6</span></div><div></div></div><div><br></div><div>I have tried the Getting Started, documentation, archieves, etc., but could not resolve the problem as I have no experiences with NCL coding. I will very much appreciate it if someone could give me some pointers.</div><div><br></div><div><font face="arial, helvetica, sans-serif">Thanks,</font><div><font face="arial, helvetica, sans-serif">Young</font></div></div><div><br></div><p style="margin:10px 0px 20px;padding:0px;color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.3333px;line-height:12pt;font-variant-numeric:normal;font-variant-east-asian:normal"><b style="margin:0px;padding:0px">Example 1</b></p><pre style="margin-top:0px;margin-bottom:0px;padding:0px;font-size:13.3333px;line-height:12pt;font-family:courier;border-style:solid;border-width:0px 0px 15px;border-color:transparent;color:rgb(0,0,0)"> N = 10
u := <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">random_normal</strong></a>( 0, 2, N) ; zonal wind 'noise'
v := <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/random_normal.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">random_normal</strong></a>(-10, 2, N) ; winds from the north
wspd := <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_speed.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">wind_speed</strong></a>(u,v)
wdir := <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">wind_direction</strong></a>(u,v,0)
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">print</strong></a>(<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">sprintf</strong></a>("%7.2f", u)+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", v)+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", wspd)+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", wdir))
x := <strong style="margin:0px;padding:0px">wind_stats</strong>(wspd, wdir, 0, False) ; variable of type 'list'
; extract variables from list for clarity
wspd_avg = x[0] ; average of 'wspd'
wspd_std = x[1] ; standard deviation of 'wspd'
wdir_avg = x[2] ; mean vector wind direction
wdir_std = x[3] ; standard deviation of the wind direction
avgU = x[4] ; average zonal component
avgV = x[5] ; average medidional wind component
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/delete.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">delete</strong></a>(x) ; no longer needed
<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/print.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">print</strong></a>(<a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml" style="margin:0px;padding:0px;text-decoration-line:none;color:rgb(0,64,255);font-family:verdana,sans-serif" target="_blank"><strong style="margin:0px;padding:0px">sprintf</strong></a>("%7.2f", wspd_avg)+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", wspd_std) \
+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", wdir_avg)+<b style="margin:0px;padding:0px">sprintf</b>("%7.2f", wdir_std) \ </pre><div><span style="color:rgb(0,0,0);font-family:courier;font-size:13.3333px"> +</span><b style="color:rgb(0,0,0);font-family:courier;font-size:13.3333px;margin:0px;padding:0px">sprintf</b><span style="color:rgb(0,0,0);font-family:courier;font-size:13.3333px">("%7.2f", avgU )+</span><b style="color:rgb(0,0,0);font-family:courier;font-size:13.3333px;margin:0px;padding:0px">sprintf</b><span style="color:rgb(0,0,0);font-family:courier;font-size:13.3333px">("%7.2f", avgV ) )</span> <br clear="all"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif"></font><br></div></div></div></div></div></div></div></div></div></div></div></div></div></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></blockquote></div>
</blockquote></div>