0

Happy Monday Everyone!

So. I'm really, really new to IDL. I need to translate a program I have written in Python to IDL, and I can barely get it started.

I am trying to define a function, but I am given the following error each time I try to compile it.

% Compiled module: OSTN02.
% Compiled module: OSTN02.
% Attempt to call undefined procedure: 'OSTN02'.
% Execution halted at: $MAIN$ 

I have tried following the guide from Harris Geospatial, but I am getting nowhere. The code is below:

FUNCTION OSTN02, DATA, EASTCOL, NORTHCOL

  ;MAY NEED TO ADD FILLNaN HERE
  DATAFILE = READLIS(FILE = !DATA_DIR + 'PROJECT ONE/OSTN15_OSGM15_DataFile.CSV', SEP = ',')

  RETURN, DATAFILE
  STOP
END

Any help is much appreciated. Thank you.

Fishbones78
  • 61
  • 11
  • Check the name of the file containing your function OSTN02. It should be ostn02.pro. You can get an error like this if the name of the function doesn't match the file name. – Steve G Nov 12 '18 at 15:28
  • Also, I think 'READLIS' should be 'READLIST', but I can't find either function in the online documentation. Maybe it's not compiling properly because it can't get 'READLIS' to compile? Also, the 'STOP' statement at the end is unnecessary, but I don't think it will cause any problems. – Steve G Nov 12 '18 at 15:48
  • @SteveG The name is indeed ostn02.pro already :( I should have added that read_lis is a function that someone here at my company has created. Thank you for the response. – Fishbones78 Nov 12 '18 at 16:33
  • Okay, if you just run the line `DATAFILE = READLIS(FILE = !DATA_DIR + 'PROJECT ONE/OSTN15_OSGM15_DataFile.CSV', SEP = ',')` from the IDL command line, does it work okay? And is it `READLIS` (as in the post) or `read_lis` (as in your comment)? – Steve G Nov 12 '18 at 19:23
  • Hi @SteveG. Yes, the line runs fine. Silly mistake, I should have proof read it. It is indeed READLIS! – Fishbones78 Nov 13 '18 at 09:05

1 Answers1

1

The error message is telling you:

% Attempt to call undefined procedure: 'OSTN02'.

You have defined a function, but IDL is looking for a procedure (because you are calling it as a procedure). The call to your function should be:

datafile = ostn02(data, eastcol, northcol)

although you aren't using those parameters, so you might want to remove them from your function.

mgalloy
  • 2,356
  • 1
  • 12
  • 10
  • I think I have been a little unclear, so I will elaborate :) The function OSTN02 will do much much more than just define DATAFILE and return it. It's only like this at the moment because I want it to work as a function before I write the rest of it. This is why I also have unused parameters! Thanks for the response – Fishbones78 Nov 13 '18 at 09:08