Re: Indecipherable error message

From: Dennis Shea (shea AT XXXXXX)
Date: Mon Dec 06 2004 - 18:44:09 MST

  • Next message: Jeffrey Yin: "Re: storm track bandpass filter"

    Hello

    I have a few comments on this.

    [1] "I was using systemfunc to deliver nmos"

        Don't understand: systemfunc returns a string.
        Not sure what was delivered but you can not use
        a variable of type string as a do terminator. A
        simple test:
        
        ncl 0> nmos = "10"
        ncl 1> do imo=1,nmos
        ncl 2> print ("imo="+imo)
        ncl 3> end do
        fatal:Loop end must be numeric value, can't execute loop
        fatal:Execute: Error occurred at or near line 3

        Looks familiar ... N'est ce pas?
        
        Perhaps the error message would be clearer if it said
        
        fatal:Loop terminator must be numeric value, can't execute loop
                   ^^^^^^^^^^
                   
        Actually, I don't think the do construct allows
        variables or constants of type float or double so use
        of the "numeric" may be misleading.
        
        hint to appropriate NCL person!!! :-)
        
        I *speculate* that the wrong line number is listed because
        the 'do block' ends at line 3.
                  
    [2] The following will work

         nmos = stringtointeger("10")
         do imo=1,nmos

    [3] The rather laborious suite of "if" statements below can
        be eliminated by use of sprinti. See Example 3 of
        
        http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/sprinti.html
        
        I looks nicer too!
        
    [4] The "asciiwrite" procedure can be used to create files
        but a better alternative may be the "write_matrix" procedure:
        
        http://ngwww.ucar.edu/ngdoc/ng/ref/ncl/functions/write_matrix.html
        
        This allows format control of output [ie .. the number of
        decimal places and the number of elements on each row,
        
        There are a lot of examples.
        
    Regards,
    Dennis Shea
         
    >
    >On Saturday, November 27, 2004, at 12:37 AM, Dave Allured wrote:
    >
    >> Please check the value of nmos before you start the loop. Stop
    >> worrying about imos.
    [snip]

    >Thanks though, (and to Don Morton for offlist comments). I was using
    >systemfunc to deliver nmos - worked OK in trials but not any more (!).
    >
    >>
    >> Ian Harris wrote:
    >>> Hi,
    >>> I'm getting an error message that doesn't - to me - make sense.
    >>> The message:
    >>> fatal:Loop end must be numeric value, can't execute loop
    >>> fatal:Execute: Error occurred at or near line 101
    >>> What does this mean? I have a 'do' loop that terminates on line 101
    >>> so I assume it refers to that.
    >>> The loop starts:
    >>> do imos=1,nmos
    >>> And ends:
    >>> end do
    >>> There are no assignments to 'imos' within the loop.
    >>> There are two 'if' statement blocks within the loop:
    >>> if (imos .lt. 10) then ;
    >>> build filename
    >>> fil = "echam.000"+imos
    >>> else
    >>> if (imos .lt. 100) then
    >>> fil = "echam.00"+imos
    >>> else
    >>> if (imos .lt. 1000) then
    >>> fil = "echam.0"+imos
    >>> else
    >>> fil = "echam."+imos
    >>> end if
    >>> end if
    >>> end if
    >>> and:
    >>> if (imos .eq. 21) then
    >>> grid = grid(:,::-1,:)
    >>> ; rereverse grid lats to descend
    >>> asciiwrite(fils(ifil)+"test21.gaussian.64x128.1col.dat",grid)
    >>> asciiwrite(fils(ifil)+"test21.regridded.72x96.1col.dat",regrid)
    >>> asciiwrite(fils(ifil)+"test21.ukwindow.8x7.1col.dat",ukwin)
    >>> end if
    >>> So, what does the error message actually mean? No idea at this end;
    >>> happy to get an answer even if it indicates goofery on my part ;-)
    >>> Cheers
    >>> Harry
    >>> Ian "Harry" Harris
    >>> Climatic Research Unit
    >>> University of East Anglia
    >>> Norwich, UK NR4 7TJ

    _______________________________________________
    ncl-talk mailing list
    ncl-talk AT ucar.edu
    http://mailman.ucar.edu/mailman/listinfo/ncl-talk



    This archive was generated by hypermail 2b29 : Tue Dec 07 2004 - 09:04:41 MST