0

I'm trying to run a large batch of data through my IDL program, but when I do I get nonsensical results.

If I split up the input and then give each piece to the program separately and then stitch the output together it works fine. This has led to to think there is an overflow problem occurring somewhere in the code, but I haven't had any luck debugging it so far.

Is there a way that I can change the default data type size in IDL so that if I declare a variable such as...

A = functionCall(blah,blah2)

it will initiate the variable as a 32bit value instead of a 16bit (which is the default)?

I know you can do this manually by doing

A = long(functionCall(blah,blah2))

by my code is a few thousand lines long and I'd rather not go through and manually change this for every variable.

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
Ryan Stull
  • 1,056
  • 14
  • 35
  • So are you having a problem with memory or the difference between `integer` and `long integer` variables? If the latter, then just add the following to your code in the relevant places: `*1L`. This will convert things to long integers. Also, IDL is 64-bit by default, unless you are running a version earlier than 6.0. – honeste_vivere Sep 28 '14 at 15:46

1 Answers1

2

If all you want to do is to default to 32-bit integers, you can put a compile_opt statement in your codes. Put

compile_opt defint32

at the top of your routines. Or,

compile_opt idl2

which is shorthand for defint32 and strictarr (enforces using square brackets for indexing). This will make IDL use 32-bit integers everywhere it would normally have used 16-bit integers.

However, I'm not sure how this addresses your 'large data' problem. You may want to use

help, /mem

to check your memory usage.

Ajean
  • 5,528
  • 14
  • 46
  • 69