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

Re: undefined keyword variables




Dusting off my degree in horse-beating...

davidf@dfanning.com (David Fanning) writes:
> 
> I think it is not only feasible, but required, that you 
> provide default values for *any* variable you plan
> to use in the code. Certainly if I were planning to
> use the POSITION keyword I would have something like this:
> 
>    IF N_Elements(thePosition) EQ 0 THEN thePosition=!P.Position
>    ...
>    Plot, data, Position=thePosition

This doesn't always work.  Here is what happens when I examine
!p.position after starting IDL fresh:

IDL> print, !version
{ alpha OSF unix 5.2 Oct 30 1998}
IDL> print, !p.position
      0.00000      0.00000      0.00000      0.00000

That causes an error when I try to plot.  Anyway, your solution takes
the previous plot position.  I was interested in using the IDL default
position.  I haven't found any logical way to figure that out. [ Okay,
there's the plot,/nodata,xstyle=5,ystyle=5 technique to set up the
coordinates ahead of time. Hmmm... ]  I run into this situation where
I have two paths in my code, one path where I set the POSITION, and
one where I just want to pass the user's value.  Check out map_set.pro
and map_struct_append to see what contortions RSI went through.

My point is that *whatever* strategy that IDL uses to pass undefined
keywords appears to be inconsistent.  It should either be documented
or corrected.

Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------