<div dir="ltr"> Attached is a small file that I used for global constants. Yes, *clumsy naming" but<br><div>I could not think of any other way to accomplish global scope  and eliminate <br>possible overwriting of the constants.<br></div><div><br></div>load "/....../CAS_common.ncl"<br><br><div>I tried to encourage people to try this approach but, alas, I was not successful.<br></div><div><br></div>NOTE: NCL <b>automatically</b> loads a large number of libraries. In fact, NCL 6.5.0:<br>    <a href="https://www.ncl.ucar.edu/future_release.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>future_release.shtml</a><br>loads [imports] every library [I think!]. What I had envisioned was:<br><pre>    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/<b>CAS_common.ncl</b>"   ; <=== <b>NOT</b> done<br>    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/contributed.<wbr>ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/shea_util.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/esmf/ESMF_<wbr>regridding.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/bootstrap.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/extval.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/crop.ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/heat_stress.<wbr>ncl"
    "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/wrf/WRFUserARW.ncl"</pre>That way, the 'global variable constants' could be used for consistency within all libraries.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 2, 2018 at 4:23 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Any variable declared/defined outside of the scope of a procedure/function/outer-<wbr>begin-end block will be in the global scope.  It has to have been defined before it is ever referenced. <br><div><br> a = 3.14<br><br>procedure foo()<br>begin<br>   print("foo sees a: " + a)<br>end<br><br>procedure bar()<br>begin<br>   print("bar sees a: " + a)         <br>end<br><br>begin<br>   print("main sees a: " + a)<br>   foo()<br>   bar()<br>end<br>(0)    main sees a: 3.14<br>(0)    foo sees a: 3.14<br>(0)    bar sees a: 3.14<br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Jul 2, 2018 at 1:43 PM, Jon Meyer <span dir="ltr"><<a href="mailto:jonathan.meyer@aggiemail.usu.edu" target="_blank">jonathan.meyer@aggiemail.usu.<wbr>edu</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>Hello,</div><div><br></div><div>I'm hoping to streamline some automated cron job NCL code I've written that could greatly benefit from having global variables set that the main program and functions/procedures can all share..mainly, the directory system I'm navigating around so I don't have to hardcode or pass directory strings in and out of variables.</div><div><br></div><div>I know NCL isn't directly able to do global variables, but some reading into this shows the ability to take advantage of NCL's scoping to essentially create global variables.<br></div><div><br></div><div>I've looked through past ncl-talk threads but the discussion on how to accomplish this is light other than it can be done, and the scoping discussion on the ncl page isn't as visually helpful on how to do this. After a few attempts, I've failed trying to follow the basic example included in the few ncl-talk threads from the past so I'm hoping someone can elaborate or provide an example for setting string (or other type) variables to be accessible to functions/procedures called from main code where the strings are set.<br></div><div><br></div><div>Any help of time is appreciated.<span class="m_541504918687906676HOEnZb"><font color="#888888"><br></font></span></div><span class="m_541504918687906676HOEnZb"><font color="#888888"><div><br>-- <br><div class="m_541504918687906676m_-5696537245400187505gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Jonathan D.D. Meyer, Ph.D.<div>Utah State University<br><div>Department of Plants, Soils & Climate</div><div>Utah Climate Center</div></div></div></div></div></div>
</div></font></span></div>
<br></div></div><span class="">______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>