[ncl-talk] Making new variables in a loop

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Apr 13 13:14:02 MDT 2021


Barry, no, you can not create new memory variables in a loop.  You CAN
create new file variables in a loop.  But I sincerely doubt that is what
you want to do.

I recommend using the reassignment operator ":=".  If that gives you a
different error, then debug that specifically.  If that is still a problem,
please show us what you mean by "another error".  HTH.


On Tue, Apr 13, 2021 at 1:04 PM Barry Lynn via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello:
>
> I define new variables:
>
>   height_gmax  = new(ng_lines,float)   ; Create array to hold marker
> objects
>   height_gmin  = new(ng_lines,float)   ; Create array to hold marker
> objects
>
> The problem is that the second time around there is an error that their
> size has changed.  But, if I add a colon (:) to the definition, I will get
> another error.
>
> Is there a way to create a new variable every time step?
>
> Thanks
>
> --
> Guest Editor of Special Issue “Extreme Hydroclimatic Events and Prediction”
> LINK:
>
> https://www.mdpi.com/journal/water/special_issues/Extreme_Hydroclimatic_Events
>
> Barry H. Lynn, Ph.D
> Senior Associate Scientist, 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210413/8343f124/attachment.html>


More information about the ncl-talk mailing list