[ncl-talk] passing args within ncl scripts

Jayant jayantkp2979 at gmail.com
Tue Jul 20 20:26:35 MDT 2021


Hi,
I want to call one ncl script (test_second.ncl) from within another ncl
script (test_prime.ncl) using system command (in fact subprocess command).
In doing so, I want to update an array (defined in test_prime.ncl) in the
second call. I am getting zeros (unchanged!!). How to proceed? Is there
something like global variables that can be defined? Below are the working
example scripts:
;==================================================
*test_prime.ncl*
begin
 ninp=10
 inparr=new(ninp,float)
 inparr=0.0

 do i=0,ninp-1
  command="ncl -Q test_second.ncl "+str_get_sq()+"ip="+i+str_get_sq()+"
"+str_get_sq()+"tmparr="+inparr(i)+str_get_sq()
  system(command)
 end do
print(inparr)
end
;==================================================
*test_second.ncl*
begin
tmparr=ip ; intend to perform some calculation and update
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210720/b3cb52b8/attachment-0001.html>


More information about the ncl-talk mailing list