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

Home » Public Forums » archive » Loop Limit Error
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Loop Limit Error [message #18174] Wed, 01 December 1999 00:00
eak is currently offline  eak
Messages: 5
Registered: December 1998
Junior Member
All,

Greetings. The function attached below is giving me the following
error:

IDL> pkp79 = makeRegularStep(pkp.propTime[10880:42511],
pkp.pkp[10880:42511], 15)
% Loop limit expression too large for loop variable type.
<LONG ( 35038)>.
% Execution halted at: MAKEREGULARSTEP 40
C:\kp\idl\makeRegularStep.pro
% $MAIN$


I tried to work around this but failed. If one of guru like status can
advise me whether I:

a) Am doing this all wrong the smart way is X.
b) Should split large arrays in bite size chunks (annoying)
c) Declare the loop somehow with a better "i" type.
d) Give up IDL programming and move to Havanna.

The summary of the function is that I have two arrays (PosixMinute,
Values). The sample rate is sudo random centered around
15 minutes. I want to get niced regularly sampled data out where value =
NAN if no samples in period, value = value if one sample, and if more
than one sample in the period average them.

Help as always appreciated!

Thanks

Eric


--------------- FUNCTION -----------------------------

;+
; NAME:
; makeRegularStep
;
; PURPOSE:
; This function takes a set of irregularly spaced time series data
along with time stamps
; and rebins it into regular fixed step values.
;
; CATEGORY:
; Time tool.
;
; CALLING SEQUENCE:
;
; regularStepData = makeRegularStep( timeArray, dataArray, binsize)
;
; INPUTS:
; TimeArray: The time steps of the orginal data. Must be some type of
posix.
; DataValues: The values of the data at the time steps above.
; Binsize: The size of the regular bin desired in same units as
TimeArray
;
; KEYWORD PARAMETERS:
;
; OUTPUTS:
; Array: An array of regularly sampled data. Contains NAN if no sample
in the cell,
; average if the cell contains multiple samples.
;
; EXAMPLE:
; regularStepData = makeRegularStep( timeArray, dataArray, binsize)
; will take the irregularly sampled dataArray and return a nice
binsize sampled regularStepData
;
; MODIFICATION HISTORY:
; Written by: Eric A. Kihn , Nov 29, 1999
;-
FUNCTION makeRegularStep, timeArray, dataArray, binsize


hist = histogram (timeArray,binsize = binsize, rev = ri) ; assumes
15 min binsize
tmpArray = fltarr(size(hist, /N_Elements) - 1); Set a new data array
with right num elements
zsize = size(hist, /N_Elements);
for i = 0 , zsize -2, 1 do begin

if (ri(i+1) eq ri(i)) then begin; No Elements in this bin set the
data to NAN
tmpArray(i) = !VALUES.F_NAN
endif else begin
binsize = ri(i+1) - ri(i)
tmpArray(i) = total(dataArray(ri(ri[i] : ri(i+1)-1)))/binsize
endelse
endfor


return, tmpArray

END
[Message index]
 
Read Message
Previous Topic: DataMiner, ODBC, MySQL
Next Topic: Segmentation Algorithm

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

Current Time: Fri Oct 10 21:58:45 PDT 2025

Total time taken to generate the page: 2.24142 seconds