Re: fatal:syntax error: line -1 before or near .

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 19 2010 - 08:57:02 MDT

Thanks Dave.

This has been filed under ticket NCL-793 in case anybody wants to inquire about it in the future.

This problem will likely show up in several versions, because I don't think it's something we introduced recently.

--Mary

On Oct 18, 2010, at 8:09 PM, Dave Allured wrote:

> Mary,
>
> Attached are simple test cases for C shell (csh) and Bourne shell (sh). These demonstrate the problem for me with the following NCL versions and platforms. The problem also occurred in previous NCL versions:
>
> NCL 5.2.1 Mac OS 10.5.8
> NCL 5.2.1 Mac OS 10.6.4
> NCL 5.2.1 GNU/Linux (X86_64)
>
> To run the demos:
>
> ./exit-test.csh < list1
> ./exit-test.sh < list1
>
> These should run cleanly as is. To trigger the exit problem, comment out the "exit" statement at the end of exit-test.ncl. I get messages similar to Justin's:
>
> fatal:syntax error: line -1 before or near .
> etc.
>
> --Dave
>
> On 10/18/2010 3:06 PM, Mary Haley wrote:
>> Hi Justin
>>
>> I'll open a ticket on this, because it's curious that you have to include
>> an exit statement.
>>
>> Does somebody have a small test case that shows the problem?
>>
>> Dave gets all the kudos here for the work-around!
>>
>> --Mary
>>
>> On Oct 18, 2010, at 2:22 PM, Justin Traiteur wrote:
>>
>>> Dave,
>>>
>>> That fixed the problem! It is funny how a seemingly innocuous line
>>> makes all the difference.
>>>
>>> thanks again,
>>>
>>> Justin
>>>
>>> Thank you too Mary!
>>>
>>>
>>> On Oct 18, 2010, at 3:07 PM, Dave Allured wrote:
>>>
>>>> This reminds me of a quirk I have seen occasionally when using a
>>>> shell script as a driver for an NCL script. NCL may continue
>>>> reading from "standard in" past the end of the script, and start
>>>> processing an input stream that belongs to the shell script, as if
>>>> that stream was additional NCL statements.
>>>>
>>>> The workaround is to simply add an "exit" statement as the very last
>>>> physical line of the NCL script. This forces NCL to terminate at
>>>> the proper time.
>>>>
>>>> I do not know whether this quirk is active in the current version of
>>>> NCL. HTH.
>>>>
>>>> --Dave A.
>>>> NOAA/PSD/CIRES
>>>>
>>>> On 10/18/2010 9:39 AM, Mary Haley wrote:
>>>>> Justin,
>>>>>
>>>>> I don't see any problems with your NCL script, but I don't
>>>>> understand this command in your shell script:
>>>>>
>>>>> setenv ncl
>>>>>
>>>>> I don't think this will hurt anything, but it shouldn't be needed.
>>>>>
>>>>> The error message says:
>>>>>
>>>>> fatal:syntax error: line -1 before or near .
>>>>> Sounding_200806011400_NN.
>>>>>
>>>>> but I don't see any reference to this name in your NCL script.
>>>>>
>>>>> Try removing the "setenv ncl" line, and running your shell script
>>>>> up to the point where it's about to call "ncl Bayesian.ncl". Then
>>>>> cd to where "Bayesian.ncl" is and type
>>>>>
>>>>> ncl Bayesian.ncl
>>>>>
>>>>> on the UNIX command line. It want to rule out that something is
>>>>> going on with your shell script.
>>>>>
>>>>> --Mary
>>>>>
>>>>>
>>>>> On Oct 18, 2010, at 7:52 AM, Justin Traiteur wrote:
>>>>>
>>>>>>
>>>>>>>
>>>>>>> Hey Everyone,
>>>>>>>
>>>>>>> I apologize for this posting being so long but I believe that I
>>>>>>> must inform you on what this code is actually doing before trying
>>>>>>> to debug. I am currently running the single column WRF model for
>>>>>>> ensembles. The WRF is an idealized version needing only input
>>>>>>> sounding and soil profiles. I have written an NCL script that
>>>>>>> interpolates the 90 m wind speed and writes is to a file named
>>>>>>> 'test.txt'. In order to do all of the ensembles I have written a
>>>>>>> shell script that reads the sounding time and date from another
>>>>>>> directory and injests it into the WRF. Then it calls the NCL
>>>>>>> script to write the wind speed to a file to be concatenated
>>>>>>> together at the end of the ensemble run. This all seems to make
>>>>>>> logical sense but unfortunately I keep getting an error from the
>>>>>>> NCL script. The error is:
>>>>>>>
>>>>>>> [jtraite2@manabe BAYESIAN]$ ./script_ensrun_MN_DY.csh
>>>>>>> Doing Sounding_200806011300_NN.txt
>>>>>>> starting wrf task 0 of 1
>>>>>>> starting wrf task 0 of 1
>>>>>>> Copyright (C) 1995-2010 - All Rights Reserved
>>>>>>> University Corporation for Atmospheric Research
>>>>>>> NCAR Command Language Version 5.2.0
>>>>>>> The use of this software is governed by a License Agreement.
>>>>>>> See http://www.ncl.ucar.edu/ for more details.
>>>>>>> fatal:syntax error: line -1 before or near .
>>>>>>> Sounding_200806011400_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>> fatal:error in statement
>>>>>>> fatal:syntax error: line 0 before or near .
>>>>>>> Sounding_200806011500_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>> fatal:error in statement
>>>>>>> fatal:syntax error: line 1 before or near .
>>>>>>> Sounding_200806011600_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>> fatal:error in statement
>>>>>>> fatal:syntax error: line 2 before or near .
>>>>>>> Sounding_200806011700_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>> fatal:error in statement
>>>>>>> fatal:syntax error: line 3 before or near .
>>>>>>> Sounding_200806011800_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>> fatal:error in statement
>>>>>>> fatal:syntax error: line 4 before or near .
>>>>>>> Sounding_200806011900_NN.
>>>>>>> -------------------------------------^
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> My NCL script is as follows and is named Bayesian.ncl
>
> <snip> (see original messages in archive)
> <exit-test.ncl><exit-test.csh><exit-test.sh><list1.txt>_______________________________________________
> 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 19 08:57:07 2010

This archive was generated by hypermail 2.1.8 : Tue Oct 19 2010 - 14:38:00 MDT