Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
On Feb 16, 1:26 pm, "L. Testut" <gaillac.s...@free.fr> wrote: > Hi all, > A simple question. I want to multiply the third dimension of a matrix > whitout using loop > > H[lon,lat,time]*filter along the time dimension for all lat,lon > > Thanks, > L. Does this work: filter = [[filter*0],[filter*0],[filter]] hnew = h*filter
> filter = [[filter*0],[filter*0],[filter]] > hnew = h*filter That would zero out all the lat & lon values wouldn't it? filter = [[filter/filter],[filter/filter],[filter]] should retain the lat & lon values.
On Feb 16, 2:24 pm, "Bob Crawford" <Snowma...@gmail.com> wrote: >> filter = [[filter*0],[filter*0],[filter]] >> hnew = h*filter > > That would zero out all the lat & lon values wouldn't it? > > filter = [[filter/filter],[filter/filter],[filter]] > > should retain the lat & lon values. Of course, I was trying to do two things at once...
On 16 fév, 21:36, "hradilv" <hrad...@yahoo.com> wrote: > On Feb 16, 2:24 pm, "Bob Crawford" <Snowma...@gmail.com> wrote:> > filter = [[filter*0],[filter*0],[filter]] >>> hnew = h*filter > >> That would zero out all the lat & lon values wouldn't it? > >> filter = [[filter/filter],[filter/filter],[filter]] > >> should retain the lat & lon values. > > Of course, I was trying to do two things at once... Sorry it doesn't work in my case I want to avoid this loop: FOR I=0,nz-1 DO z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter I have a H[nx,ny,nz] where nz is the time. So i have nz field in time that i want to multiply by a filter of size nz. Is it possible to avoid this loop ? Thanks Laurent
This: FOR I=0,nz-1 DO z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter can be done like this: z*=rebin(reform(indgen(nz),1,1,nz),nx,ny,nz,/sample) However, is this really what you want? i have the feeling you want to do something else here, or is it just me :-)? On 18 Feb 2007 07:12:05 -0800, "L. Testut" <gaillac.spam@free.fr> wrote: > Sorry it doesn't work in my case I want to avoid this loop: > > FOR I=0,nz-1 DO > z[indgen(nx),indgen(ny),I]=Z[indgen(nx),indgen(ny),I]*filter > > I have a H[nx,ny,nz] where nz is the time. So i have nz field in time > that i want to multiply by a filter of size nz. > > Is it possible to avoid this loop ?
Oeps, indgen(nz) must be filter. On Mon, 19 Feb 2007 10:26:36 +0100, Wox <nomail@hotmail.com> wrote: > z*=rebin(reform(indgen(nz),1,1,nz),nx,ny,nz,/sample)