comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Newbie IDl question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Newbie IDl question [message #28459] Wed, 12 December 2001 20:47 Go to next message
John[1] is currently offline  John[1]
Messages: 1
Registered: December 2001
Junior Member
can someone tell me as to from where I can download IDL
if it is freely available?
thanks
John
Re: Newbie IDL question [message #52106 is a reply to message #28459] Mon, 08 January 2007 20:53 Go to previous message
Mike[2] is currently offline  Mike[2]
Messages: 99
Registered: December 2005
Member
tony.ohagan@gmail.com wrote:
> Ahh ... actually I can reproduce the same sytax errors when running the
> program from
> $ idl myprog.pro

Tony - Just what is in your myprog.pro?

If it looks like this:

name = 'Larry'
CASE name OF
'Larry': PRINT, 'Stooge 1' & $
'Moe': PRINT, 'Stooge 2' & $
'Curly': PRINT, 'Stooge 3' & $
ELSE: PRINT, 'Not a Stooge' & $
ENDCASE

then running it from the command line with idl myprog.pro will work
because that is essentially the same as starting IDL and typing
@myprog, which uses the command line interpreter. Your "& $"s
make everything look like a single line command, which is all the
command line interpreter can handle.

If you actually create a program like this and put it in myprog2.pro:

pro myprog2
name = 'Larry'
CASE name OF
'Larry': PRINT, 'Stooge 1'
'Moe': PRINT, 'Stooge 2'
'Curly': PRINT, 'Stooge 3'
ELSE: PRINT, 'Not a Stooge'
ENDCASE
end

then you can start IDL and give the command myprog2. IDL will
find myprog2.pro, look for myprog2 in it and compile it (and it will
compile without errors becuase the compiler can handle multiline
statements) and then run it.

Does that work for you?

Mike
Re: Newbie IDL question [message #52107 is a reply to message #28459] Mon, 08 January 2007 20:29 Go to previous message
tony.ohagan is currently offline  tony.ohagan
Messages: 3
Registered: January 2007
Junior Member
tony.oha...@gmail.com wrote:
>> If this already in a program, you don't need the & and $. If this is
>> at the command line, I must ask, why are you using a case block at the
>> command line? Seems, well, strange, but that's just me.
>
> No I'm not using it from the command line.
> I've already got it inside a .pro file.
> I'm running it via NASA's SeaDAS library - perhaps this is the culprit?
>
> $ seadas myprog.pro
>
> I agree that it's very strange and contrary to all examples in the IDL
> manuals.
> Unfortunately if I don't use "& $" suffixes I get syntax errors.
>
>> If you're using if, else, for, or while, and sometimes case and switch,
>> then you should be using begin and end[if|else|for|while]. Here's a
>> short example for each:
>
> In fact I'm already using begin/ends in my case statements.
> I've read the IDL manuals on case statements.
> This example was from the manual.

Ahh ... actually I can reproduce the same sytax errors when running the
program from
$ idl myprog.pro

... so it's not seadas.
Re: Newbie IDL question [message #52108 is a reply to message #28459] Mon, 08 January 2007 20:26 Go to previous message
tony.ohagan is currently offline  tony.ohagan
Messages: 3
Registered: January 2007
Junior Member
> If this already in a program, you don't need the & and $. If this is
> at the command line, I must ask, why are you using a case block at the
> command line? Seems, well, strange, but that's just me.

No I'm not using it from the command line.
I've already got it inside a .pro file.
I'm running it via NASA's SeaDAS library - perhaps this is the culprit?

$ seadas myprog.pro

I agree that it's very strange and contrary to all examples in the IDL
manuals.
Unfortunately if I don't use "& $" suffixes I get syntax errors.

> If you're using if, else, for, or while, and sometimes case and switch,
> then you should be using begin and end[if|else|for|while]. Here's a
> short example for each:

In fact I'm already using begin/ends in my case statements.
I've read the IDL manuals on case statements.
This example was from the manual.
Re: Newbie IDL question [message #52109 is a reply to message #28459] Mon, 08 January 2007 20:04 Go to previous message
Braedley is currently offline  Braedley
Messages: 57
Registered: September 2006
Member
JD Smith wrote:
> On Mon, 08 Jan 2007 15:40:55 -0800, tony.ohagan wrote:
>
>> I new to IDL but have lots of experience in other programming languages.
>>
>> It appears that all nested control statements IF/CASE/WHILE etc force me
>> to
>> suffix every line with & $ to avoid syntax errors. Is there any way of
>> ridding myself of this pain?
>>
>> Example:
>>
>> name = 'Larry'
>> CASE name OF & $
>> 'Larry': PRINT, 'Stooge 1' & $
>> 'Moe': PRINT, 'Stooge 2' & $
>> 'Curly': PRINT, 'Stooge 3' & $
>> ELSE: PRINT, 'Not a Stooge' & $
>> ENDCASE
>
> Do you mean from the command line? Put them in a file foo.pro sans & $
> and:
>
> IDL> .run foo
>
> JD

If this already in a program, you don't need the & and $. If this is
at the command line, I must ask, why are you using a case block at the
command line? Seems, well, strange, but that's just me.

If you're using if, else, for, or while, and sometimes case and switch,
then you should be using begin and end[if|else|for|while]. Here's a
short example for each:

for stooge_num=0, 3 do begin
case stooge_num of
1:begin
name='Larry'
PRINT, 'Stooge 1'
end
2:begin
name='Curly'
PRINT, 'Stooge 2'
end
3:begin
name='Moe'
PRINT, 'Stooge 3'
end
else:begin
name=''
PRINT, 'Not A Stooge'
endelse
endcase
endfor
stooge_num=temporary(stooge_num)*(-2)
while stooge_num ne 0 do begin
if stooge_num ne abs(stooge_num) then begin
stooge_num=abs(temporary(stooge_num))
print, 'Ahh, negative number!'
endif else begin
stooge_num--
print, "We're on our way!"
endelse
endwhile
Re: Newbie IDL question [message #52111 is a reply to message #28459] Mon, 08 January 2007 15:48 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Mon, 08 Jan 2007 15:40:55 -0800, tony.ohagan wrote:

> I new to IDL but have lots of experience in other programming languages.
>
> It appears that all nested control statements IF/CASE/WHILE etc force me
> to
> suffix every line with & $ to avoid syntax errors. Is there any way of
> ridding myself of this pain?
>
> Example:
>
> name = 'Larry'
> CASE name OF & $
> 'Larry': PRINT, 'Stooge 1' & $
> 'Moe': PRINT, 'Stooge 2' & $
> 'Curly': PRINT, 'Stooge 3' & $
> ELSE: PRINT, 'Not a Stooge' & $
> ENDCASE

Do you mean from the command line? Put them in a file foo.pro sans & $
and:

IDL> .run foo

JD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Newbie IDL question
Next Topic: Writing on an image

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:01:07 PDT 2025

Total time taken to generate the page: 0.00705 seconds