;+ ; NAME: ; rd_2_position ; PURPOSE: (one line) ; Write the beam positions ; DESCRIPTION: ; Write a short log ; tables/YYMMDD_2_position_SETNO.txt ; CATEGORY: ; NIRES reduction ; CALLING SEQUENCE: ; wr_2_position, datestr, set ; INPUTS: ; datestr: string (YYMMDD) ; sets: array of set structures ; nset: number of sets ; OUTPUTS: ; SIDE EFFECTS: ; write tables/YYMMDD_2_position_SETNO.txt ; RESTRICTIONS: ; tables directory must exist ; PROCEDURE: ; MODIFICATION HISTORY: ; Written 2021 Dec 30, by Leslie Young, SwRI ;- function rd_2_position, datestr, setno, framenum, object, dpatname, beam_override fn = 'tables/'+datestr+'_2_position_'+string(setno, form='(I03)')+'.txt' if not isfile(fn) then return, -1 formp = '(I5, X,A-12, X, A-7, 3X, I1, 3X,I1, 2X, F7.3, X, F7.3,2X, F7.3,X,F7.3,X,F7.3, 2X,A10, A10)' readfmt, fn, formp, framenum, object, dpatname, dpatipos, dpatnpos, xoffset, yoffset, xi_arcsec, eta_arcsec, d, beam, beam_override,$ skip=2, /silent nsets = n_elements(beam) beam = strtrim(beam,2) beam_override = strtrim(beam_override,2) if nsets ne (file_lines(fn)-2) then return, -1 return, nsets end