Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top