[gradsusr] Sharing variables when running a script within another script
camilabe at gmail.com
Wed Aug 1 14:31:42 EDT 2018
Hello all! Can anyone help me with a script to convert .bin files into .nc?
I am running the script "lats4d.gs" within a loop in another script (
I've defined one variable (_a) in myscript.gs before calling lats4d.gs, and
I want to use this variable in lats4d.gs to name the output files (the
output files should be named as prec_1.nc, prec_2.nc, and so on). However,
I can't get the variable recognized by lats4d.gs.
Here is myscript.gs:
_a = 1
while (_a <= 3)
_a = _a + 1
And here is the only part of lats4d.gs that I've changed (line 1253):
_ofname = 'C:/Users/XXX/Desktop/XXX/prec_'_a
Although myscript.gs is successfully running, the output file is saved as "
prec__a.nc" (and not prec_1.nc, prec_2.nc, as I expected).
The 'while' loop is working fine (I've tested it), but since the file name
is always "prec__a.nc", I end up with only one file saved.
Does anyone know how to fix this? I believe I "just" need to make lats4d.gs
understand "_a" as the variable defined in myscript.gs, but I am not sure
if this is really the case, and how to do it.
Any help is welcome!
Thanks in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gradsusr