function tykw_0pa_freq,rd0pa,mfreq

;+
; NAME:
;       TYKW_0PA_FREQ
;
; PURPOSE:
;       This function is to extract the 0p0a data of the specified frequency
;
; CALLING SEQUENCE:
;       d0pa=tykw_0pa_freq(rd0pa,mfreq)
;
; INPUTS:
;       rd0pa: structure of the 0P0A data
;       mfreq: frequency ID (0: 9GHz, 1: 4GHz, 2: 2GHz, 3: 1GHz)
;
; OPTIONAL INPUT KEYWORDS:
;
; OUTPUTS:
;       d0pa: structure of the 0P0A data of the specified frequency
;
; HISTORY:
;    4/6/79        ver.0.0 K. Shibasaki as fortran program
;    Sep. 09, 1994 ver.1.0 M. Nishio
;    Jan. 10, 1995 ver.2.0 M. Nishio
;    Apr. 13, 1995 ver.3.2 M. Nishio
;    Apr. 13, 1995 ver.4.0 M. Nishio
;    May. 23, 1995 ver.5.0 M. Nishio
;    May  01, 1995 ver.5.2 M. Nishio
;    Apr. 25, 1995 ver.5.0 M. Nishio
;
;    1999-01-12 ported to IDL by TY
;
;-

case mfreq of
  0 : freq=9400
  1 : freq=3750
  2 : freq=2000
  3 : freq=1000
endcase

whr=where(rd0pa.freq eq freq,count)
if (count eq 1) then d0pa=rd0pa(whr)

return,d0pa
end
