Re: Pass a string to NCL from within a c-shell variable?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 12 2010 - 08:06:21 MDT

Maurice,

If the below doesn't work, you can also try the "testit.csh" c-shell script with the "test.ncl" NCL script:

testit.csh:

#!/bin/csh -f

set f="test.nc"

eval ncl fname=\\\"$f\\\" test.ncl

test.ncl:

if(.not.isvar("fname")) then
  print("fname not defined")
else
  print("fname = " + fname)
end if

--Mary

On Oct 11, 2010, at 8:34 AM, Dennis Shea wrote:

> Hi Muarice
>
> [1] Maybe [untested]
>
> ncl inFile=\"{$outFile}.tmp.nc \" outFile=\"{$outFile}.nc"
> ./hybrid2Pres.ncl
>
> [2] For sure
>
> %> ncl ./hybrid2Pres.ncl
>
> where within the hybrid2Pres.ncl script you use
>
> inFile = getenv("outFile") + ".tmp.nc"
> outFile = getenv("outFile") + ".nc"
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/getenv.shtml
>
> Let me know
>
> On 10/11/10 5:38 AM, Maurice.McHugh@noaa.gov wrote:
>> Dear NCL-ers,
>>
>> I have a c-shell script in which I pass available to a NCL script as command line. NCL doesn’t appear to see the string contained in the variable, and has trouble interpreting the $.
>> Alternatives I could use include passing the string as an ENV or by writing the strings to a text file, but neither seem particularly elegant.
>>
>> Shell code snippet:
>> ncl inFile=$outFile.tmp.nc outFile=$outFile.nc ./hybrid2Pres.ncl
>> /code
>>
>> Can anyone suggest how I pass a string to NCL from within a c-shell variable?
>>
>> Many thanks,
>>
>> Maurice
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Oct 12 08:06:30 2010

This archive was generated by hypermail 2.1.8 : Tue Oct 12 2010 - 15:27:00 MDT