Re: Syntax error at end of NCL script

From: Kyle Griffin <ksgriffin2_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 25 2014 - 11:36:55 MST

Hi A.J.,

You need an 'end if' for each statement. As there is no formal "else if"
statement in NCL, each statement is its own call to 'if..else..end if' type
formatting, and is incomplete without a corresponding end if for each "if
(...) then" style statement.

Here you should use a total of six "end if" statements to properly close
your calls to 'if'

You can read more about this in the reference manual at:
http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclStatements.shtml

Let us know if you still have issues after trying that.

Kyle

----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1421
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2@wisc.edu

On Tue, Feb 25, 2014 at 12:29 PM, A.J. Eiserloh
<arthur.eiserloh@gmail.com>wrote:

> Hi,
>
> I am getting a strange syntax error at the end of my NCL script that I
> have never gotten before. It will not allow me to move forward with the
> script no matter how many times I try to modify it.
>
> I get the errors:
>
> fatal:syntax error: line 45 in file test1.ncl before or near \n
> end
> ---^
>
> fatal:error in statement
> fatal:syntax error: line -1 before or near
>
> ^
>
> fatal:error in statement
>
>
>
> Here is my script:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
>
> runs = (/"ctrl","sn1","n2","n3","3dvar_t1","3dvar_t2","3dvar_t3"/)
> nr = dimsizes(runs)
>
> ; 0 1 2 3 4 5 6 7 8 9 10
> 11 12
> sites = (/"czc","hld","lsn","rod","sth","str","ptv","wls"/)
> ;NORTH COAST
> ;
> ;sites =
> (/"ata","bbd","blu","cfx","cmn","cnh","fhl","gks","hys","ndn","ocr","ovl","spd"/)
> ;windward sierra (13)
>
> ns = dimsizes(sites)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; GET REAL PRECIP
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> pp_real=new((/ns,139/),"float")
> s=0
>
> if (sites(s).eq. "ata".or."cmn".or."cnh".or."ocr") then
> col = 8
> else if (sites(s) .eq. "hld".or."lsn".or."ndn".or."wls") then
> col = 9
> else if (sites(s) .eq. "gks") then
> col = 11
> else if (sites(s) .eq. "sth".or."str") then
> col = 13
> else if (sites(s) .eq. "blu".or."spd") then
> col = 14
> else if (sites(s) .eq. "bbd".or."czc".or."fhl") then
> col = 15
> end if
>
> jd=333
> h=0
> filename =
> "/home/eiserloh/Research/AR/PSD/metar/"+sites(s)+"/"+sites(s)+"12"+tostring(jd)+"."+sprinti("%0.2i",h)+".m"
> data = readAsciiTable(filename,1,"string",0)
> print(data)
> dims = dimsizes(data)
> print(dims)
> end
>
>
>
> The end of my script looks fine. Would anyone happen know why it is
> telling me this?
> --
> Arthur J. Eiserloh, Jr.
> San Jose State University
> Graduate Student
> Dept. of Meteorology and Climate Science
>
> _______________________________________________
> 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 Feb 25 11:37:28 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST