[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: array dimensions

JD Smith wrote:
> Paul van Delst wrote:
> >
> > Martin Schultz wrote:
> > >
> > > Not a favorite keyword, but a favorite tool: Get a decent system (if
> > > you haven't one), install emacs with idlwave, run the routine-info
> > > collection, and then you have all the keywords you never knew but
> > > always dreamt about literally at your fingertips.
> >
> > Similar to typing "?" at the IDL prompt and getting similar info - with examples no less!
> > Gasp!
> Not even *sort of* similar.  Yes, it's the same information (Carsten
> simply process the pdf manuals to get the documentation).  But the
> access is amazingly better.  Example:
> IDL> d=size(myvar,/
> Hmm what was that keyword to size?  I'll hit [Tab] to see. Up comes:

I type "size" <Enter> in the Online help window (after alt-tab-ing to the app, or moving
mouse over app).

> Possible completions are:
> DIMENSIONS                         FILE_LUN
> L64                                N_DIMENSIONS
> N_ELEMENTS                         STRUCTURE
> TNAME                              TYPE
> Aha, DIMENSIONS, I think that's it.  Why don't I right click on it to
> find out.  Up pops in the help window with help on size() displayed,

Help on size() is displayed for me and, if required <pageDown> gets me to "DIMENSIONS"

> and queued up to:
>       Set this keyword to return the dimensions
>       of Expression. If Expression is scalar, the
>       result is a scalar containing a 0. For arrays,
>       the result is an array containing the array
>       dimensions. ...
> OK, dimensions it is, middle click on it:

don't take my hands off keyboard, but

> IDL> d=size(myvar,/DIMENSIONS

that's pretty neat (inserting it automagically like that).

> Aren't there some other arguments to size()?  I don't recall.  I'll just
> show the calling syntax.  [C-c ?].  Here comes:
> Usage:    Result = SIZE( Expression)
> Source:   Builtin

I get that up front.

> Hmm. I guess not.  But what is that STUCTURE keyword all about.  I don't
> remember that one.  Why not right click on it (it's blue, which means it
> exists in the help).

Once again: <pageDown> (if required)

>       Set this keyword to return all available
>       information about Expression in a structure.
> OK, I'll file that away for a rainy day.

Me too.

> As you can see, you soon
> become intimately aware of all the keywords in all your favorite
> routines, and able to summon them into existence with a few keystrokes.

Me too.

> One positive side effect of keyword completion is that I am no longer
> lazy when it comes to partial keywords (OK I'm still lazy, but IDLWAVE
> is not).  No longer is my code littered with framents like
> "a=size(var,/DIME)" and other non-sequiturs.

I never did that anyway (except for /INFO instead of /INFORMATIONAL since "info" is a
common, understood contraction.) since I have an horrendous memory - but I concede that
keyword completion is an extremely handy/good-for-eliminating-fat-finger-errors type of
thing. When I first started using emacs, I found there was just too many
ctrl-alt-esc-shift-meta-letter/number sequences to remember.

Diffr'nt strokes, I guess.


Paul van Delst           A little learning is a dangerous thing;
CIMSS @ NOAA/NCEP        Drink deep, or taste not the Pierian spring;
Ph: (301)763-8000 x7274  There shallow draughts intoxicate the brain,
Fax:(301)763-8545        And drinking largely sobers us again.
paul.vandelst@noaa.gov                   Alexander Pope.