[ncl-talk] Array initialization question

Vollaro, David dvollaro at albany.edu
Mon Jul 2 14:10:44 MDT 2018


Hi,


I have created a procedure to read an ASCII dataset.  The procedure will fill several 1D variable arrays and pass them back to the main NCL script.  My problem is that the call statement contains several variables that have not been previously defined.  The length of these arrays will be determined in the procedure and is dataset dependent.  Is there a way to predefine a variable array w/o knowing its size?  Attached is a snippet of code:


Dave Vollaro

...

main script...

data_read(file,lat,lon)

....

 procedure data_read(rfile:string,rlat[*]:float,rlon[*]:float)
 begin

  recon_data   := asciiread(rfile,-1,"string")
  rlat = stringtofloat(str_get_cols(recon_data, 9,15))
  rlon = stringtofloat(str_get_cols(recon_data, 23,29))
  return

 end
fatal:Variable (lat) is undefined

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180702/f4d40e1e/attachment.html>


More information about the ncl-talk mailing list