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

Home » Public Forums » archive » arithmetic operation on array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
arithmetic operation on array [message #85477] Mon, 12 August 2013 13:59 Go to previous message
Phillip Miller is currently offline  Phillip Miller
Messages: 4
Registered: August 2013
Junior Member
Possibly a dumb question, but I'm pretty new to IDL:

I have a geographically explicit time-series with 456 time steps and a
1 degree resolution, so an array of dimensions 360 x 180 x 456, and I
would like to recalculate it as the anomaly from the time-series
average.

I can calculate the time series average no problem

> average = mean(data, dimension=3)

But, of course, when I try

> anomaly = data - mean(data, dimension=3)

then I "lose" my third dimension, and end up with an array of 360 x
180, rather than what I want, which is an array that is the same size
as my original.

I know that I could loop it like

> for i = 0,456 data[*,*,i] = data[*,*,i] - mean(data, dimension=3)

but I feel like there must be a better way than making a for loop. Am
I supposed to duplicate mean(data, dimension=3) times 456 in order to
create an identically sized array for the minus operation? (i.e., an
array with dimensions 360 x 180 x 456, but where each of the 456
"slices" is identical)

Thanks in advance for any suggestions!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Graphics PS/PDF output size/orientation
Next Topic: Not IDL Related Question

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

Current Time: Wed Oct 08 19:10:35 PDT 2025

Total time taken to generate the page: 0.00447 seconds