pro CUTATTRACT, reihe, klassr, creihe, rpc=rpc

;+
; NAME:
;       CUTATTRACT
; PURPOSE:
;       Cutting attractor sequences from detrended level 1 time series
; EXPLANATION:
;       readme.txt
;
;
; CALLING SEQUENCE:
;       CUTATTRACT, reihe, klassr, creihe, [rpc=]
; INPUTS:
;       reihe: detrended level 1 time series
; OPTIONAL INPUT:
;       rpc: value for invalid points; default is !values.f_nan
;
; OUTPUTS:
;       klassr: output of findattract ((3, m) vector)
;       creihe: detrended level 1 timesries with removed attractors
; PROCEDURES USED:
;None
;
; MODIFICATION HISTORY:
;       Package 'SPM level 1.5' written between 2000 and 2003, Richard Wachter, PMOD/WRC
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 l=size(klassr)
 n=n_elements(reihe)
 if not keyword_set(rpc) then rpc=!values.f_nan

 creihe=reihe

 for i=0, l[2]-1 do begin

  if klassr[2,i] ge 400 and klassr[1,i] lt n   then creihe[klassr[0,i]:klassr[1,i]]=rpc

 endfor


end

