[ncl-talk] unable to pass an argument to NCL code

Geeta Geeta geetag54 at yahoo.com
Wed Mar 18 05:46:30 MDT 2020


Hi.

I have to run My ncl code for large number of days having same data format
(example, -rw-r----- 1 aditya aditya 38874040 Jul  9  2018 02apr2008.ua.nc
-rwx--x--x 1 aditya aditya 38874040 Jul 10  2018 03mar2006.ua.nc
-rwx--x--x 1 aditya aditya 38874040 Jul 10  2018 05apr2009.ua.nc
-rwx--x--x 1 aditya aditya 38874040 Jul 10  2018 05mar2005.ua.nc)

I have written a small script that will pass on the argument 02apr2008.ua.nc,  03mar2006.ua.nc..... to the NCL code.


The script (ATTACHED) is reading partcular files and assigning to the variable $myvar which goes as input to the code.

for i in $(ls ?????????.ua.nc); do
echo  $i
myvar=$i
echo $myvar

First few lines of the code are

SPLIT_FILE   =    str_split(name_of_file,".")
                     print(SPLIT_FILE)

name_of_file variable will be passed on by shell script. 
But variables are not being passed correctly. 
 the output is .

Variable: SPLIT_FILE
Type: string
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:	[1]
Coordinates: 
(0)	$myvar


Variable: storms_file
Type: string
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes:	[1]
Coordinates: 
(0)	dcc.$myvar.txt
fatal:["FileSupport.c":3973]:($myvar) has no file extension, can't determine type of file to open
Segmentation fault (core dumped)


2. I tried to pass argument on the command line and it runs well. 
aditya at agniilap:~/geeta/ncl/Plotecmf$ ../bin/ncl 'name_of_file="02apr2008.ua.nc"' ecmf.v5.ua.ncl

I have to run this script in batch mode as large number of days are there. 

thanks

Geeta.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: script1.sh
Type: application/x-shellscript
Size: 177 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200318/6a61d6fc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ecmf.v5.ua.ncl
Type: application/octet-stream
Size: 14877 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200318/6a61d6fc/attachment.obj>


More information about the ncl-talk mailing list