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

Re: array dimensions

"Richard G. French" wrote:
> Paul van Delst wrote:
> >
> > IF ( n GT 1 ) THEN SMOOTH( array, n )
> >
> > ?
> That's fine if you want this to be on a single line, but there are
> plenty
> of times when SMOOTH(array, n) is in a plot command, or in part of a
> complex
> expression. I think the argument about rebin is exactly similar - of
> course,
> you can do the checking ahead of time, but who wants to add this check
> for every time you do dynamic smoothing? adds lots of unneeded hair to
> the code. Smoothing by 1 is not the same as dividing by zero. It is like
> convolving with a one-element array, which IDL is perfectly willing to
> do without complaining and dying.

Fair enough. Complaining and dying is a decidedly poor response. I guess it would be nice
to be able to put a 

IF ( n LE 1 ) THEN RETURN, array


  MESSAGE, 'N < or = 1, exiting...'
  RETURN, array

as the first executable statement(s) in a smooth.pro, if it existed for users to meddle
with. I just checked the IDL documentation and it doesn't state that n=1 is invalid. In
fact, it is implicitly valid since it is an odd number. So, wouldn't the problem with
SMOOTH when n=1 be a bug ... that RSI should fix?


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.