function norp_t2i,array,value

;+
; NAME:
;       NORP_T2I
;
; PURPOSE:
;       This function is to get the position of specified 'value' in array
;
; CALLING SEQUENCE:
;       norp_t2i,array,value
;
; INPUTS:
;       array: 1-dimensional array
;              must be increasing manner
;       value: the value to be searched
;
; OPTIONAL INPUT KEYWORDS:
;
; OUTPUTS:
;       ipos: the position of specified 'value' in array
;
; HISTORY:
;       programmed by T. Kosugi in 1984 May as Fortran program 
;       for old NoRP data format
;       re-programmed by H.Sekiguchi 1987 July - 1988 Dec.
;
;       1995 July,20    N,Shinox for new format NoRP data
;       95.04.19   ed.  add ATT correction for pol data ,correction data type
;                    changed intarr() to fltarr().,
;       95.09.04 Ver.2.0  M. Nishio and K. Hori
;       95.11.10 Ver.3.0  M. Nishio refernce level at 9.4GHz= amb -> zero
;  <<Caution: ambient level at 9.4GHz is incorrect. Use zero as ref. level>>
;       95.12.12 Ver.3.1  M. Nishio and K. Shibasaki (1GHz ATT 7dB -> 4.3)
;       98.09.03          sekix  & shinox   add 80GHz
;       98.11.20  K. Hori
;       1999-1-12 TY unify program for old/new NoRP data
;
;-

mx=n_elements(value)
if mx eq 1 then values=[value] else values=value

ipos=lonarr(mx)

for m=0,mx-1 do begin
 value0=values(m)

 tmp=abs(array-value0)
 pos=where(min(tmp) eq tmp)
 ipos(m)=pos(0)
endfor

if mx eq 1 then ipos=ipos(0)

return,ipos
end
