
PRO RH_SEL_FREQ, nomfich, freq_req, ind_frq
;+ ***********************************************************************
; NAME: RH_SEL_FREQ
;
; PURPOSE:
;      calcule les indices des frequences a traiter 
; 
; CATEGORY:
;       Traitement de fichiers NRH.
;
; INPUTS:
;  NOMFICH  : nom du fichier
;  FREQ_req     : tableau des frequences a traiter
;
; OUTPUTS:
;  IND_FRQ  : intarr() indices des frequences 
;             ind_frq(k) = -1 quand la frequence n'existe pas
; MODIFICATION HISTORY:
; version janvier 2003 : choix des frequences 
;  calcule les indices des frequences a traiter 
;  bug corrige mai 2007 : freq etait modifie dans la procedure.
;
;-*******************************************************************
    @rh_common.inc 
    freq1 = floor(freq_req)
    ind_frq = intarr(n_elements(freq1))
    if not rh_open(nomfich,/mono)then begin
        print,' fichier non trouve :',nomfich
        stop
    endif
    rh_close
    freq=entfi.frq
    hdeb=entfi.hdeb
    hfin=entfi.hfin
; calcul des indices des frequences a traiter :
    freq_rh = floor(entfi.frq/10.)
    for k = 0, n_elements(freq1)-1 do begin
        ind_frq(k) = where(freq_rh eq freq1(k),nc)
        ; ind_frq(k) = -1 quand la frequence n'existe pas
    endfor
    chformat = '(" - manip ", 2(2x,i2.2,":",i2.2,":",i2.2,".",i2.2),'+$
                     '" frequences RH : ",10i4) '
    print,format= chformat, hdeb, hfin, freq_rh(0:entfi.nf-1)
;       print,' ----- frequences choisies  : ',freq
;       print,' ----- indices des frequences choisies  : ',ind_frq(*)
end
