<div dir="ltr">On a related note ....<br><br>The just released 6.4.0 has a function that may be of use in some instances:<br><br> <a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/cla_sq.shtml">http://www.ncl.ucar.edu/Document/Functions/Contributed/cla_sq.shtml</a><br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 6:59 AM, 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"><div><div><div><div><div><div><div>Hi,<br><br></div>If I understand correctly, you can pass in the values on the command-line invocation of NCL as:<br><br></div> ncl w1=X dw1=Y<br><br></div>where X and Y are the actual values. To pass in string arguments, we tell people to place quotes around the whole var=value pair, like:<br><br></div> ncl 'myStringVar="foo"'<br><br></div>You can find more info about passing in arguments at:<br><br> <a href="http://ncl.ucar.edu/Document/Manuals/Ref_Manual/NclCLO.shtml" target="_blank">http://ncl.ucar.edu/Document/<wbr>Manuals/Ref_Manual/NclCLO.<wbr>shtml</a><br><br></div>Hope that helps...<br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Mar 1, 2017 at 12:20 AM, Abheera Hazra <span dir="ltr"><<a href="mailto:hazra.abheera@gmail.com" target="_blank">hazra.abheera@gmail.com</a>></span> wrote:<br></div></div><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">Hi,<div><br></div><div>I am using NCL to calculate a few terms for an optimization algorithm and I am calling the NCL function from within a 'while loop' in a bash script. The 'while loop' runs till a certain condition is met and for the condition to be met, the bash script needs to accept a new value for an existing variable from the NCL script. I have tried using system, systemfunc with even the export command but nothing seems to work. The code looks as follows:</div><div><br></div><div>------------------------------<wbr>------------</div><div>#!/bin/bash<br></div><div><br></div><div><div>w1=0.4</div><div>dw1=0.1</div></div><div>inc=0.001</div><div><br></div><div>while awk 'BEGIN { if ('$dw1'<'$inc') {exit 1}}'; do<br></div><div><br></div><div><div>cat <<'EOF' >> opti.error.ncl</div></div><div><br></div><div>;;;;Perform certain computations on w1 and update the w1 and dw1</div><div>w1=nw1</div><div>dw1=ndw1</div><div><br></div><div><div> system("w1=" + w1)</div><div> system("dw1=" + dw1)</div></div><div><br></div><div>;;;;w1 and dw1 need to be passed to the bash script</div><div><br></div><div>EOF</div><div><br></div><div><br></div><div> ncl k1=${w1} dw11=${dw1} opti.error.ncl<br></div><div><br></div><div>echo $w1</div><div>echo $dw1</div><div><br></div><div>done</div><div>------------------------------<wbr>------------<br></div><div><br></div><div>But this does not update w1 and dw1 values. Any input would be greatly appreciated.</div><div><br></div><div>Thanks,</div><div>Abheera</div><div><br></div><div><br></div></div>
<br></div></div>______________________________<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></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>