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

Home » Public Forums » archive » Problem with suppression of dimension
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Problem with suppression of dimension [message #22878] Wed, 13 December 2000 16:25 Go to previous message
jeyadev is currently offline  jeyadev
Messages: 78
Registered: February 1995
Member
This may be a FAQ candidate, but I cannot find anything in the PV-Wave
manuals or in David's (fine) book.

I am having problem with the following code fragment:

......
......

nsteps = 5
npts = 1 ; number of data points within each layer
ncols = 5

dpt = {fullrow, cood:fltarr(4), colcode: ''}
fulldata = replicate(dpt, nsteps*npts*ncols)

avdata = fltarr(4,nsteps*ncols)

for i = 0,nsteps*ncols-1 do begin
j = i*npts
for k = 0,3 do avdata(k,i) = avg(fulldata(j:j+npts-1).cood(k))
print, Format="(4(4x,f8.4), 5x, a1)", avdata(*, i), cols(i/nsteps)
endfor

........
........

This basic job of the code is to take a 2-d array of dimensions
(4, nsteps*npts*ncols) and then reduce this dataset to a another
2-d array of dimensions (4,nsteps*ncols) by averaging over blocks
of 'npts' rows. (For arcane reasons, the 'colcode' variable is
present in every row of the raw matrix and hence the structure.)

This works fine for npts > 1 (that is the usual case and I have
been using the procedure for a while), but if, as I now need,
npts = 1, I get an error from the AVG procedure as the argument
being passed is not an array:

Variable must be an array, name= ARRAY, routine AVG.

Now for some trouble shooting ....

With i = j = 0 and setting k = 0, for example

WAVE> i = 0 & j = 0
WAVE> avdata = fltarr(4,nsteps*ncols)
WAVE> k = 0
WAVE> info, fulldata(j:j+npts-1).cood(k)
<Expression> FLOAT = 28.3790



On the other hand with npts = 2, the same gives

WAVE> npts = 2
WAVE> info, fulldata(j:j+npts-1).cood(k)
<Expression> FLOAT = Array(2)



So the question is, how do I force the float to be an array of
length 1 when npts = 1?

I would like to avoid using an

if(npts eq 1)then avdata = fulldata.cood(0:2) else ....

if I can.

I seem to remember reading about this issue of avoiding the
suppression of trailing degenerate dimesions, but I cannot find
it in my private hints database (collected from this NG), online
anywhere, in the manual and not even in David's superb tome.

Any pointers will be appreciated.

I am using PV-WAVE CL Version 6.01 (sun4 solaris sparc).

Needless to add, if there is a completely different way of
accomplishing the row-wise averaging, I will gladly throw
my method in the dustbin. :-)

thanks


--

Surendar Jeyadev jeyadev@wrc.xerox.com
[Message index]
 
Read Message
Read Message
Previous Topic: PV-WAVE
Next Topic: HIST_EQUAL

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

Current Time: Wed Dec 03 07:40:16 PST 2025

Total time taken to generate the page: 1.68801 seconds