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

Home » Public Forums » archive » RFC 1: Common functions for beginners
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
RFC 1: Common functions for beginners [message #35080] Wed, 14 May 2003 15:39 Go to next message
Ed Wright is currently offline  Ed Wright
Messages: 39
Registered: February 1999
Member
To: IDL guri
From: Ed Wright

I have a request for comments (just like the IETF).

I learned the basics of IDL use and programming over a long time interval
while writing the magnum opus of dlms. Rather than have new users repeat my
learning process, I'd like your suggestions for the twenty or so most common
IDL functions a new user should understand.

I mean most basic-most used. Open file, read numbers, plot numbers, write
text, close file.

As always,
Ed Wright
Re: RFC 1: Common functions for beginners [message #35134 is a reply to message #35080] Tue, 20 May 2003 09:38 Go to previous messageGo to next message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Big Bird wrote:
...
> I've come across these situations a few times; and so far the best
> choice was every time to go into the code and rewite it to expect a
> true-color display. I cannot imagine what economic upheavals would
> have to happen to make people go back to 8-bit pseudo color...

Some people never left 8-bit psuedo color. Neither of my two home
machines have graphics cards which can do true color when running at the
highest resolution the monitor can support. One of them has so little
memory on the graphics card that I wouldn't dream of running it in true
color mode (there's room for extra memory chips on that card, but it's
been several years since it was possible to buy compatible chips for
that card). I've used both machines to remotely log into work, and I've
displayed IDL graphics on those monitors. I won't say it was easy: doing
X-windows across a 56K connection is painfully slow. However, it did
display properly, when I used the right IDL settings.
Re: RFC 1: Common functions for beginners [message #35135 is a reply to message #35080] Tue, 20 May 2003 09:42 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning (david@dfanning.com) writes:

> A few times!? I pretty much run into it constantly, and
> I go to GREAT effort to write programs in a device-independent
> fashion. If you are restricted to direct graphics for whatever
> reason, there are some things you can't do EXCEPT with
> DEVICE, DECOMPOSED=0. Filled contour plots come immediately
> to mind. :-(

Whoops! I was so exercised I hit that Send button before
I was ready.

But what makes this *essential* to teach in the first
20 things you have to know, is that if you run into it
your first impression is that you have gone completely
crazy (It worked yesterday!!) instead of blaming the
stupid software for not being able to figure it out.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: RFC 1: Common functions for beginners [message #35136 is a reply to message #35080] Tue, 20 May 2003 09:28 Go to previous message
Matt Feinstein is currently offline  Matt Feinstein
Messages: 33
Registered: July 2002
Member
On 20 May 2003 09:12:16 -0700, condor@biosys.net (Big Bird) wrote:

> "Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<bac8jd$4vp$1@newsreader.mailgate.org>...
>> "Big Bird" <condor@biosys.net> wrote in message
>> news:df160b8f.0305191535.214da775@posting.google.com...
>>> I disagree that people need to know "device,decomposed=0" as this
>>> already presumes a certain color model.
>>
>> Then I take it you won't mind David redirecting all email inquiries on this
>> subject to you?
>
>
> Heh - go ahead: all email to this account is automatically bounced to
> president@whitehouse.gov - clearly we need a national color model
> infrastructure... ;)
>
> (Slightly more seriously: the OP was referring to things to teach to
> people he has sitting in front of him, not random people who send him
> emails because they can't get some program to work that was written in
> the early neolithic.)
>
> ObIDL: maybe I understand device,decomposed=0 wrong, but it is really
> only useful if you have a true-color display (like every cheap PC
> these days!) and you're trying to use something that was written in
> the bad old days of 8-bit indexed color, right? (Wrong?)
>
> I've come across these situations a few times; and so far the best
> choice was every time to go into the code and rewite it to expect a
> true-color display. I cannot imagine what economic upheavals would
> have to happen to make people go back to 8-bit pseudo color...

It's not so much a hardware issue as a question of how to display data
that comes to you compressed and encoded in pseudocolor-- there's a
performance penalty if you display it in 'true' color. But even in
that case, these days, you pay only a rather small penalty.


Matt Feinstein

--
The Law of Polarity: The probability of wiring a battery with
the correct polarity is (1/2)^N, where N is the number of times
you try to connect it.
Re: RFC 1: Common functions for beginners [message #35137 is a reply to message #35080] Tue, 20 May 2003 09:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Big Bird (condor@biosys.net) writes:

> (Slightly more seriously: the OP was referring to things to teach to
> people he has sitting in front of him, not random people who send him
> emails because they can't get some program to work that was written in
> the early neolithic.)
>
> ObIDL: maybe I understand device,decomposed=0 wrong, but it is really
> only useful if you have a true-color display (like every cheap PC
> these days!) and you're trying to use something that was written in
> the bad old days of 8-bit indexed color, right? (Wrong?)

Right. Like 95% of the programs living in your IDL directory
structure. :-)

> I've come across these situations a few times; and so far the best
> choice was every time to go into the code and rewite it to expect a
> true-color display. I cannot imagine what economic upheavals would
> have to happen to make people go back to 8-bit pseudo color...

A few times!? I pretty much run into it constantly, and
I go to GREAT effort to write programs in a device-independent
fashion. If you are restricted to direct graphics for whatever
reason, there are some things you can't do EXCEPT with
DEVICE, DECOMPOSED=0. Filled contour plots come immediately
to mind. :-(

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: RFC 1: Common functions for beginners [message #35138 is a reply to message #35080] Tue, 20 May 2003 09:12 Go to previous message
condor is currently offline  condor
Messages: 35
Registered: January 2002
Member
"Mark Hadfield" <m.hadfield@niwa.co.nz> wrote in message news:<bac8jd$4vp$1@newsreader.mailgate.org>...
> "Big Bird" <condor@biosys.net> wrote in message
> news:df160b8f.0305191535.214da775@posting.google.com...
>> I disagree that people need to know "device,decomposed=0" as this
>> already presumes a certain color model.
>
> Then I take it you won't mind David redirecting all email inquiries on this
> subject to you?


Heh - go ahead: all email to this account is automatically bounced to
president@whitehouse.gov - clearly we need a national color model
infrastructure... ;)

(Slightly more seriously: the OP was referring to things to teach to
people he has sitting in front of him, not random people who send him
emails because they can't get some program to work that was written in
the early neolithic.)

ObIDL: maybe I understand device,decomposed=0 wrong, but it is really
only useful if you have a true-color display (like every cheap PC
these days!) and you're trying to use something that was written in
the bad old days of 8-bit indexed color, right? (Wrong?)

I've come across these situations a few times; and so far the best
choice was every time to go into the code and rewite it to expect a
true-color display. I cannot imagine what economic upheavals would
have to happen to make people go back to 8-bit pseudo color...
Re: RFC 1: Common functions for beginners [message #35147 is a reply to message #35080] Mon, 19 May 2003 20:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mark Hadfield (m.hadfield@niwa.co.nz) writes:

>> I disagree that people need to know "device,decomposed=0" as this
>> already presumes a certain color model.
>
> Then I take it you won't mind David redirecting all email inquiries on this
> subject to you?

I've kept track. I've only answered the question 5,456,489 times!

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: RFC 1: Common functions for beginners [message #35148 is a reply to message #35080] Mon, 19 May 2003 20:46 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Big Bird" <condor@biosys.net> wrote in message
news:df160b8f.0305191535.214da775@posting.google.com...

> Integers are 16 bit! "Loop limit expression too large". 'Nuff said.

Not quite 'nuff:

compile_opt DEFINT32

> I disagree that people need to know "device,decomposed=0" as this
> already presumes a certain color model.

Then I take it you won't mind David redirecting all email inquiries on this
subject to you?

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: RFC 1: Common functions for beginners [message #35150 is a reply to message #35080] Mon, 19 May 2003 16:35 Go to previous message
condor is currently offline  condor
Messages: 35
Registered: January 2002
Member
Ed Wright <ed.wright@jpl.nasa.gov> wrote in message news:<BAE813AB.B700%ed.wright@jpl.nasa.gov>...
> To: IDL guri
> From: Ed Wright
>
> I have a request for comments (just like the IETF).
>
> I learned the basics of IDL use and programming over a long time interval
> while writing the magnum opus of dlms. Rather than have new users repeat my
> learning process, I'd like your suggestions for the twenty or so most common
> IDL functions a new user should understand.
>
> I mean most basic-most used. Open file, read numbers, plot numbers, write
> text, close file.
>
> As always,
> Ed Wright


I think such alist would depend on the background of the user. Someone
mentioned that IDL counts from zero, which is important if you have a
fortran background but natural to someone who comes from C. (and could
go either way with someone who doesn't know any programming at all).
The 'format' for formatted output is trivial to the fortran guy, but
will stump the C-programmer. etc.

I wonder why nobody has mentioned indgen/findgen yet.

I also don't think anybody has mentioned plotting into a PS device.

Someone needs to spell out that there's two "help-functions", one is
called "?" and the other is called "help". Something like
"help,!P,/struct" can tell you where to start looking for something or
what to look for in the "?".

If people have any programming background at all, I'd hand them
"begin...end" as the basic grouping tool and mention that "end" can
often optionally be replaced with a more descriptive "endfor" or
"endif" and such and that this should be done. (I spent a year or two
blindly using 'if ... begin ... endif else begin ... endelse' without
knowing why IDL syntax for 'else' was so screwy, until someone told me
to think of the 'endif' and 'endelse' as 'end' and suddenly it's all
fairly trivial).

Integers are 16 bit! "Loop limit expression too large". 'Nuff said.

Many people mentioned "where" and it should include ",/count" so that
"if count gt 0 then ..."

The most common things in PLOT: psym=, thick=,
[xy]range=,/[xy]style,color=
[xy]title= vs. title= vs. subtitle=

a = indgen(20) & a[0:10] = (b = (a[5:15] = indgen(11)*3)) & print,a
; etc

When to ignore error messages (like Floating errors and such)

a = b+c/d ; if b,c and d are arrays of different dimensions.

Some word of warning about 'histogram'

I disagree that people need to know "device,decomposed=0" as this
already presumes a certain color model. Instead I'd introduce to
people the different color models and then direct them to something
that works for their machine (Some students are being placed in front
of a 5-year old Sparc box with 256 colors, some others have 24 (or
even 32-bit displays...) PLUS Some method to get a few clear,
well-known colors (red, green, blue, yellow) into their plot on screen
and in PS

Just what comes to my mind...
Re: RFC 1: Common functions for beginners [message #35182 is a reply to message #35080] Fri, 16 May 2003 11:21 Go to previous message
Kelly Dean is currently offline  Kelly Dean
Messages: 92
Registered: March 1997
Member
Opps! URL is mis-spelled. I haven't learn how to cut and paste in
Linux yet.

http://reef.atmos.colostate.edu/dean/IDL20tips.htm

Kelly


Kelly Dean wrote:

>
> In my last job, I did alot of work with college students needing to
> learn IDL to do their class work. After reading the comments on this
> newsgroup I started writing some of my methods down that I used to get
> these students going.
>
> There are two list I started, although they are incomplete right now.
> One list is for getting started and the other is for the students asking
> how to do this better, which were few and far between.
>
>
>
> Kelly Dean
> CSU/ATS
>
> Ed Wright wrote:
>
>> To: IDL guri
>> From: Ed Wright
>>
>> I have a request for comments (just like the IETF).
>>
>> I learned the basics of IDL use and programming over a long time interval
>> while writing the magnum opus of dlms. Rather than have new users
>> repeat my
>> learning process, I'd like your suggestions for the twenty or so most
>> common
>> IDL functions a new user should understand.
>>
>> I mean most basic-most used. Open file, read numbers, plot numbers, write
>> text, close file.
>>
>> As always,
>> Ed Wright
>>
>>
>
Re: RFC 1: Common functions for beginners [message #35186 is a reply to message #35080] Fri, 16 May 2003 11:09 Go to previous message
Kelly Dean is currently offline  Kelly Dean
Messages: 92
Registered: March 1997
Member
In my last job, I did alot of work with college students needing to
learn IDL to do their class work. After reading the comments on this
newsgroup I started writing some of my methods down that I used to get
these students going.

There are two list I started, although they are incomplete right now.
One list is for getting started and the other is for the students asking
how to do this better, which were few and far between.

http://reef/atmos.colostate.edu/dean/IDL20tips.htm

Kelly Dean
CSU/ATS

Ed Wright wrote:

> To: IDL guri
> From: Ed Wright
>
> I have a request for comments (just like the IETF).
>
> I learned the basics of IDL use and programming over a long time interval
> while writing the magnum opus of dlms. Rather than have new users repeat my
> learning process, I'd like your suggestions for the twenty or so most common
> IDL functions a new user should understand.
>
> I mean most basic-most used. Open file, read numbers, plot numbers, write
> text, close file.
>
> As always,
> Ed Wright
>
>
Re: RFC 1: Common functions for beginners [message #35198 is a reply to message #35080] Thu, 15 May 2003 18:38 Go to previous message
Jeff Guerber is currently offline  Jeff Guerber
Messages: 41
Registered: July 2000
Member
On Wed, 14 May 2003, Ed Wright wrote:

> I learned the basics of IDL use and programming over a long time interval
> while writing the magnum opus of dlms. Rather than have new users repeat my
> learning process, I'd like your suggestions for the twenty or so most common
> IDL functions a new user should understand.
>
> I mean most basic-most used. Open file, read numbers, plot numbers, write
> text, close file.

1) Not really a function or procedure, but fundamental to making good
use of IDL: Vectors, arrays, and operations on them, including in
particular vector-vector, vector-array, and array-array operations, in
addition to those involving scalars. Especially for those who cut their
teeth on C or who haven't upgraded their Fortran compiler in 25 years! :-)
As a subtopic here, vector indexing and WHERE. (Someone mentioned SORT
and UNIQ along with WHERE, but I find I use those _much_ less often.
Also, I think REBIN and HISTOGRAM, which Pavel mentioned, are much more
advanced topics.)

2) PLOT. After all, it's pretty much IDL's raison d'... d'...
oh phooey... reason for existence!

3) _Correct_ use of AND, OR, and NOT in making logical comparisons. As
bitwise operators, this isn't always obvious to the uninitiated.

4) On a somewhat more advanced level (so probably further down than #4
in the final list), pointers. Since IDL's pointer facility is so
different from C's, it's something that users often find confusing when
they first try them.

5) Something I've rarely seen discussed, but which might be a really
good topic: When NOT to use IDL! Heretical as it may sound, it's not
always the best choice... or even a good one. For example, I once had the
misfortune to work on a project where we were archiving large quantities
of data from Exabyte tapes onto video disks, doing various validations
along the way. The Civil Servant in charge insisted on using IDL for the
processing pipeline. There was no way it could keep up with the flood!
A Fortran version I coded up ran in 1/2 to 2/3 the time, and he still
wouldn't let me use it. Don't get me wrong, IDL's terrific for many
things... but this wasn't one of them!

Jeff Guerber
Re: RFC 1: Common functions for beginners [message #35203 is a reply to message #35080] Thu, 15 May 2003 11:13 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst (paul.vandelst@noaa.gov) writes:

> Since we're dealing with absolutes here, let me suggest a correction:
> 1. Always use the GET_LUN _procedure_

Truth be told, I'd forgotten there *was* a
GET_LUN procedure. :-(

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: RFC 1: Common functions for beginners [message #35204 is a reply to message #35080] Thu, 15 May 2003 11:04 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Matt Feinstein wrote:
>
> On Wed, 14 May 2003 15:39:23 -0700, Ed Wright <ed.wright@jpl.nasa.gov>
> wrote:
>
>>
>> To: IDL guri
>> From: Ed Wright
>>
>> I have a request for comments (just like the IETF).
>>
>> I learned the basics of IDL use and programming over a long time interval
>> while writing the magnum opus of dlms. Rather than have new users repeat my
>> learning process, I'd like your suggestions for the twenty or so most common
>> IDL functions a new user should understand.
>>
>> I mean most basic-most used. Open file, read numbers, plot numbers, write
>> text, close file.
>>
>> As always,
>> Ed Wright
>
> Some things I learned the hard way:
> 0. The 'where am I' and 'what am I doing here' functions CD, ? , PRINT
> 1. Always use the /GET_LUN flag

Since we're dealing with absolutes here, let me suggest a correction:
1. Always use the GET_LUN _procedure_

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Re: RFC 1: Common functions for beginners [message #35205 is a reply to message #35080] Thu, 15 May 2003 10:37 Go to previous message
Matt Feinstein is currently offline  Matt Feinstein
Messages: 33
Registered: July 2002
Member
On Wed, 14 May 2003 15:39:23 -0700, Ed Wright <ed.wright@jpl.nasa.gov>
wrote:

>
> To: IDL guri
> From: Ed Wright
>
> I have a request for comments (just like the IETF).
>
> I learned the basics of IDL use and programming over a long time interval
> while writing the magnum opus of dlms. Rather than have new users repeat my
> learning process, I'd like your suggestions for the twenty or so most common
> IDL functions a new user should understand.
>
> I mean most basic-most used. Open file, read numbers, plot numbers, write
> text, close file.
>
> As always,
> Ed Wright

Some things I learned the hard way:
0. The 'where am I' and 'what am I doing here' functions CD, ? , PRINT
1. Always use the /GET_LUN flag
2. How to write programs so they don't have to be explicitly compiled
3. How to use WINDOW, WSET, and the various interrelated coordinate
systems
4. The sorting and searching functions-- WHERE, SORT, UNIQ



Matt Feinstein

--
The Law of Polarity: The probability of wiring a battery with
the correct polarity is (1/2)^N, where N is the number of times
you try to connect it.
Re: RFC 1: Common functions for beginners [message #35210 is a reply to message #35080] Thu, 15 May 2003 09:12 Go to previous message
Liam E. Gumley is currently offline  Liam E. Gumley
Messages: 378
Registered: January 2000
Senior Member
"Ed Wright" <ed.wright@jpl.nasa.gov> wrote in message
news:BAE813AB.B700%ed.wright@jpl.nasa.gov...
> To: IDL guri
> From: Ed Wright
>
> I have a request for comments (just like the IETF).
>
> I learned the basics of IDL use and programming over a long time interval
> while writing the magnum opus of dlms. Rather than have new users repeat
my
> learning process, I'd like your suggestions for the twenty or so most
common
> IDL functions a new user should understand.
>
> I mean most basic-most used. Open file, read numbers, plot numbers, write
> text, close file.
>
> As always,
> Ed Wright

Ed,

No doubt we can all come up with our twenty favorite IDL functions,
procedures, or statements that new users should understand. However it seems
to me a bit like asking for my 20 favorite functions or statements in C,
FORTRAN, Java, etc.

To get new users climbing the IDL learning curve quickly, I think it's much
more effective to have them work through a good book on IDL programming. I'm
told there are several decent titles available.

Cheers,
Liam.
Practical IDL Programming
http://www.gumley.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Passing file LUN to C routine
Next Topic: Re: Postscript line thickness

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

Current Time: Wed Oct 08 20:01:40 PDT 2025

Total time taken to generate the page: 0.59413 seconds