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

Home » Public Forums » archive » Re: moving average of a large array
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
Re: moving average of a large array [message #51442] Mon, 27 November 2006 09:21 Go to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
David Fanning wrote:
> Jenny writes:
>
>> Thanks for your kind reminder! I see they are not the same. What I
>> really want is a 5 or 7 point moving average of the 3rd dimension of my
>> array. Why couldn't they add the convenient arguments/keywords to
>> TS_SMOOTH?!
>
> Maybe they will when you ask you ask them nicely. :-)
>
> Most programs are written with a particular purpose in
> mind. But anyone who has shared programs with the world
> quickly comes to realize that either (A) people can't
> read the documentation, or (B) people could care less
> about the documentation and want to use the program for
> their own purposes anyway. It's an eye-opening experience.
>
> Over time you get a little better at anticipating how
> people are going to use/abuse your programs and you make
> allowances for that in your coding. But only a savant could
> see all the possibilities. :-)

Or you could label your code as opiniated software. See:
http://tinyurl.com/7ojc8

A small quote:
<quote>
Rails is opinionated software. It eschews placing the old ideals of software in a primary
position. One of those ideals is flexibility�the notion that we should try to accommodate
as many approaches as possible, that we shouldn't pass judgement on one form of
development over another.
</quote>

cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Re: moving average of a large array [message #51472 is a reply to message #51442] Fri, 24 November 2006 08:30 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Maybe they will when you ask you ask them nicely. :-)

Humm. I'm getting so used to hitting the ;;; key multiple
times to get it to work that now I see I'm typing whole
phases multiple times. Maybe it's time to make that trip
to Circuit City to get a new keyboard. :-(

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: moving average of a large array [message #51473 is a reply to message #51472] Fri, 24 November 2006 08:27 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jenny writes:

> Thanks for your kind reminder! I see they are not the same. What I
> really want is a 5 or 7 point moving average of the 3rd dimension of my
> array. Why couldn't they add the convenient arguments/keywords to
> TS_SMOOTH?!

Maybe they will when you ask you ask them nicely. :-)

Most programs are written with a particular purpose in
mind. But anyone who has shared programs with the world
quickly comes to realize that either (A) people can't
read the documentation, or (B) people could care less
about the documentation and want to use the program for
their own purposes anyway. It's an eye-opening experience.

Over time you get a little better at anticipating how
people are going to use/abuse your programs and you make
allowances for that in your coding. But only a savant could
see all the possibilities. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: moving average of a large array [message #51474 is a reply to message #51473] Fri, 24 November 2006 08:17 Go to previous messageGo to next message
envi35@yahoo.ca is currently offline  envi35@yahoo.ca
Messages: 48
Registered: March 2005
Member
Hi David,
Thanks for your kind reminder! I see they are not the same. What I
really want is a 5 or 7 point moving average of the 3rd dimension of my
array. Why couldn't they add the convenient arguments/keywords to
TS_SMOOTH?!

Good day,
Jenny

David Fanning wrote:
> Jenny writes:
>
>> Hi, thanks for you reply. I must have been blinded not seeing SMOOTH
>> can be used instead of TS_SMOOTH for multi-dimension array!!
>
> Well, I think you might want to be a bit careful here,
> as the "smoothing" carried out by TS_SMOOTH is not the
> same as the "smoothing" implemented by SMOOTH, I think.
> Just be sure you know what you are doing. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: moving average of a large array [message #51485 is a reply to message #51474] Fri, 24 November 2006 07:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jenny writes:

> Hi, thanks for you reply. I must have been blinded not seeing SMOOTH
> can be used instead of TS_SMOOTH for multi-dimension array!!

Well, I think you might want to be a bit careful here,
as the "smoothing" carried out by TS_SMOOTH is not the
same as the "smoothing" implemented by SMOOTH, I think.
Just be sure you know what you are doing. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: moving average of a large array [message #51487 is a reply to message #51485] Fri, 24 November 2006 06:46 Go to previous messageGo to next message
envi35@yahoo.ca is currently offline  envi35@yahoo.ca
Messages: 48
Registered: March 2005
Member
Hi, thanks for you reply. I must have been blinded not seeing SMOOTH
can be used instead of TS_SMOOTH for multi-dimension array!!

Jenny

Kenneth P. Bowman wrote:
> In article <1164296828.559622.31580@m7g2000cwm.googlegroups.com>,
> "Jenny" <envi35@yahoo.ca> wrote:
>
>> Hi, I want to calculate the moving average of a large array:
>> data[800,800,365]. The moving average is for the 3rd dimension - day of
>> year. But TS_SMOOTH only works for a vector. Anyone knows if there is
>> another function in IDL that I could use? I probably can use TS_SMOOTH
>> and for loops to get this, but it will be slow. In addition, there are
>> invalid data in my array as well.
>>
>> I've read discussions in this list about adding Dimension and NAN
>> keywords to other functions, such as Total, Median, etc., which are
>> very useful. Why nobody cares about TS_SMOOTH? Or am I asking a silly
>> question? Is there an obvious way to calculate the moving average of a
>> large array?
>>
>>
>> Thanks,
>> Jenny
>
> If x = FLTARR(800, 800, 365)
>
> try
>
> y = SMOOTH(x, [1, 1, 3])
>
> This runs a boxcar smoother, which has awful spectral characteristics.
> You also might want to consider what to do at the edges.
>
> Ken Bowman
Re: moving average of a large array [message #51499 is a reply to message #51487] Thu, 23 November 2006 19:58 Go to previous messageGo to next message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <1164296828.559622.31580@m7g2000cwm.googlegroups.com>,
"Jenny" <envi35@yahoo.ca> wrote:

> Hi, I want to calculate the moving average of a large array:
> data[800,800,365]. The moving average is for the 3rd dimension - day of
> year. But TS_SMOOTH only works for a vector. Anyone knows if there is
> another function in IDL that I could use? I probably can use TS_SMOOTH
> and for loops to get this, but it will be slow. In addition, there are
> invalid data in my array as well.
>
> I've read discussions in this list about adding Dimension and NAN
> keywords to other functions, such as Total, Median, etc., which are
> very useful. Why nobody cares about TS_SMOOTH? Or am I asking a silly
> question? Is there an obvious way to calculate the moving average of a
> large array?
>
>
> Thanks,
> Jenny

If x = FLTARR(800, 800, 365)

try

y = SMOOTH(x, [1, 1, 3])

This runs a boxcar smoother, which has awful spectral characteristics.
You also might want to consider what to do at the edges.

Ken Bowman
Re: moving average of a large array [message #51591 is a reply to message #51442] Mon, 27 November 2006 09:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> Or you could label your code as opiniated software.

I just take it for granted that anyone who downloads
software from my web page knows it's opinioned software.
Otherwise, what's the point? :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: ENVI - Output to external format - seem to be losing georeferencing
Next Topic: IDLy approach to splatting points on a grid?

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

Current Time: Wed Oct 08 15:13:08 PDT 2025

Total time taken to generate the page: 0.00659 seconds