[ncl-talk] A NCL Mystery Solved

Barry Lynn barry.h.lynn at gmail.com
Thu Oct 19 08:18:32 MDT 2017


Hi:

I have this error (it didn't obviously show up with a Google search).

fatal:Assign: Hits_1 is undefined, can not subscript an undefined variable

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 17 in file
./test.ncl

Before defining Hits_1 as an array of size n_days, I needed the : to do the
sum.

However, it is the : that causes the error when the variable is defined as
an array.

I am not sure why, but I thought I would make a note of it for those who
encounter the same error message.


begin

  n_days  = 3

  dims = 9

  Hits_1 = new(n_days,float)

  printVarSummary(Hits_1)

  Hits_4km = new(n_days,float)

  Hits_1 = 0

  Hits_4km = 0

  do ii_day = 0,dims,1

   if (ii_day .eq.0)then

   i_day = tointeger(0)

   else

   i_day = (mod(ii_day,3))

   end if

   printVarSummary(i_day)

   print("i_day = " + i_day)

    *Hits_1(i_day) := Hits_4km(i_day) + Hits_1(i_day) ; **remove colon if
Hits_1 is defined as an array.*

  end do

end



-- 
Barry H. Lynn, Ph.D
Senior Lecturer,
The Institute of the Earth Science,
The Hebrew University of Jerusalem,
Givat Ram, Jerusalem 91904, Israel
Tel: 972 547 231 170
Fax: (972)-25662581

C.E.O, Weather It Is, LTD
Weather and Climate Focus
http://weather-it-is.com
Jerusalem, Israel
Local: 02 930 9525
Cell: 054 7 231 170
Int-IS: x972 2 930 9525
US 914 432 3108
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171019/d2826fc4/attachment.html>


More information about the ncl-talk mailing list