1

I have a IDL program which reads data from binary file. I am a newbie in IDL and so I can't help with a few lines in the program. Any help would be appreciated.

''' PRO READTHREEDIMENSIONAL,VAR,singlefname,NX,NY,NZ

; DECLARE VARIABLES
  VAR = {NX:0L,NY:0L,NZ:0L}
  VAR.NX = NX
  VAR.NY = NY
  VAR.NZ = NZ
  rread   = DBLARR(VAR.NX)
  phiread = DBLARR(VAR.NY)
  NCOSYSread = -1L

'''

What is the meaning of: 1) NX:0L 2) NCOSYSread = -1L

mgalloy
  • 2,356
  • 1
  • 12
  • 10
avijayan
  • 11
  • 2

1 Answers1

0
  1. The NX:0L defines a long integer field NX in the VAR structure.
  2. The NCOSYSread = -1L line defines a variable a long integer variable NCOSYSread that presumably would be used to read into via READU or READF later in this code.
mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • Yes, 'NCOSYSread' is used to read using 'READF' command in the later part of the program. Since I am new to IDL, I have not completely understood what you have explained. I understand that 'NX:0L' is a long integer variable, what about 'NCOSYSread=-1L' ? Is it also a variable that is long integer ? If yes, what diference do "0" and "-1" make before "L". ? – avijayan May 22 '19 at 05:55
  • It is just defining the type of the variable. The actual value of `NCOSYSread` will change when it is read. The author probably put `-1L` as the initial value because that is an invalid value, so it would be clear that if the value was still -1 at some later point that the data had not been read. – mgalloy May 22 '19 at 16:48