; TBOUT ;--------------------------------------------------------------- ;! Writes an AIPS table into a text file for user editting. ;# TASK TABLE UTILITY ;----------------------------------------------------------------------- ;; Copyright (C) 1995, 2008-2009 ;; Associated Universities, Inc. Washington DC, USA. ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2 of ;; the License, or (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public ;; License along with this program; if not, write to the Free ;; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, ;; MA 02139, USA. ;; ;; Correspondence concerning AIPS should be addressed as follows: ;; Internet email: aipsmail@nrao.edu. ;; Postal address: AIPS Project Office ;; National Radio Astronomy Observatory ;; 520 Edgemont Road ;; Charlottesville, VA 22903-2475 USA ;----------------------------------------------------------------------- TBOUT LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC TBOUT: Task to Write AIPS tables to text files. INNAME Image name (name) INCLASS Image name (class) INSEQ 0.0 9999.0 Image name (seq. #) INDISK 0.0 9.0 Disk drive # INEXT Extension type INVERS -5.0 46655.0 Extension file version # OUTTEXT External text file name. DOCRT Max width of output (char) BCOUNT 0.0 999999.0 Begin Table record to Write ECOUNT 0.0 999999.0 End Table record to Write ---------------------------------------------------------------- TBOUT Type: Task Use: TBOUT writes AIPS tables to an external text file. Adverbs: INNAME......Image name (name). Standard defaults. INCLASS.....Image name (class). Standard defaults. INSEQ.......Image name (seq. #). 0 => highest. INDISK......Disk drive # of image. 0 => any. INEXT.......Extension file type ' ' => 'TA' INVERS......Extension file version # 0 => highest. OUTTEXT.....External text file name. DOCRT.......Max. width of the output in characters. If all columns cannot fit in this maximum size then several passes will be made through the data. .LE. 40 => 80. BCOUNT......Begin Table record to Write; Output file recond numbers will be labeled starting at 1 ECOUNT......End Table record to Write ---------------------------------------------------------------- TBOUT: DOCUMENTOR: G. I. Langston and W. D. Cotton, NRAO. RELATED PROGRAMS: PRTAB, TACOP, TABED and other tables routines PURPOSE The purpose of this task and its twin TBIN is to provide a way to export AIPS tables outside of the AIPS system and to introduce data from external sources into an AIPS table. The means of exchange is via a text file which contains first a FITS like header section describing the file (See Going AIPS chapter on FITS files) followed by a multi-column table. If the table cannot fit in DOCRT characters it will be divided into as many blocks of columns which will fit into DOCRT characters. If the table contains arrays of values, these values are listed by repeating the row in the table of columns. The row will be repeated for each element of the array. OUTTEXT One must supply the name of the external file via the AIPS adverb OUTTEXT. Examples: OUTTEXT='disk$res:[myarea.pgm]table.txt' (VMS) OUTTEXT='myarea:table.txt' (Unix) where MYAREA is an environment variable set before starting AIPS: %setenv MYAREA /mnt/fschwab/sim An example UV flag (FG) file is listed below. The text file has the basic FITS format with keywords and HISTORY Lines permitted. Note several points: a) XTENSION is the table type, either a simple TABLE or aips 3d table, A3DTABLE b) NAXIS1 is the width of the text file in characters. c) NOPASS is the number of passes needed to fit all columns of the table into NAXIS1 chars. d) TFIELDS is the actual number of Columns in the Table. e) TBCOL lists the start column of the table field and pass containing the variable. The Field pass is decoded by: PASS(I) = TBCOL(I)/1000 + 1 The Field begin column is decoded by: BCOL(I) = MOD ( TBCOL(I), 1000) f) TFDIM is the Field DIMension; number of array elements, characters or bits. A dimension of 0 is allowed. g) END An END card must preceed column labels h) LABEL Labels are repeated before each pass. i) ROW Each record must start with a row number. Flaged Table entries are marked by negative ROW numbers. ROW number is repeated for the maximum dimension of the Fields in each pass. In the example below, columns 1, 2, 7 and 8 have dimension 1, while columns 3, 4, 5 and 6 have dimension 2. Characters and Bits MUST have dimension 1. If a variable is written with other variables having greater array length, double quotes ('') mark the variable location. j) PASS Passes have different dimensions. In Pass 2 of the example, all variables have dimension 1, so Rows are listed only once. The begin and end of the data part of each pass is marked with strings '***BEGIN*PASS***' and '***END*PASS***' starting in column 1. XTENSION= 'A3DTABLE' / extension type BITPIX = 8 / printable ASCII codes NAXIS = 2 / Table is a matrix NAXIS1 = 80 / Max. no. of characters/pass NAXIS2 = 7 / Number of entries in table PCOUNT = 0 / Random parameter count GCOUNT = 1 / Group count NOPASS = 2 / Number of passes thru table TFIELDS = 8 / Number of fields in each row EXTNAME = 'AIPS FG ' / AIPS table file EXTVER = 1 / Version Number of table TBCOL1 = 9 / Starting char. pos. of field TFORM1 = 'I12 ' / Fortran format of field 1 TFDIM1 = 1 / Dimension of field 1 TTYPE1 = 'SOURCE ' / type (heading) of field 1 TUNIT1 = ' ' / physical units of field 1 TBCOL2 = 20 / Starting char. pos. of field TFORM2 = 'I12 ' / Fortran format of field 2 TFDIM2 = 1 / Dimension of field 2 TTYPE2 = 'SUBARRAY' / type (heading) of field 2 TUNIT2 = ' ' / physical units of field 2 TBCOL3 = 31 / Starting char. pos. of field TFORM3 = 'I12 ' / Fortran format of field 3 TFDIM3 = 2 / Dimension of field 3 TTYPE3 = 'ANTS ' / type (heading) of field 3 TUNIT3 = ' ' / physical units of field 3 TBCOL4 = 42 / Starting char. pos. of field TFORM4 = 'E15.6 ' / Fortran format of field 4 TFDIM4 = 2 / Dimension of field 4 TTYPE4 = 'TIME RAN' / type (heading) of field 4 TUNIT4 = 'DAYS ' / physical units of field 4 TBCOL5 = 57 / Starting char. pos. of field TFORM5 = 'I12 ' / Fortran format of field 5 TFDIM5 = 2 / Dimension of field 5 TTYPE5 = 'IFS ' / type (heading) of field 5 TUNIT5 = ' ' / physical units of field 5 TBCOL6 = 68 / Starting char. pos. of field TFORM6 = 'I12 ' / Fortran format of field 6 TFDIM6 = 2 / Dimension of field 6 TTYPE6 = 'CHANS ' / type (heading) of field 6 TUNIT6 = ' ' / physical units of field 6 TBCOL7 = 1009 / Starting char. pos. of field TFORM7 = 'X4 ' / Fortran format of field 7 TFDIM7 = 4 / Dimension of field 7 TTYPE7 = 'PFLAGS ' / type (heading) of field 7 TUNIT7 = ' ' / physical units of field 7 TBCOL8 = 1018 / Starting char. pos. of field TFORM8 = 'A24 ' / Fortran format of field 8 TFDIM8 = 24 / Dimension of field 8 TTYPE8 = 'REASON ' / type (heading) of field 8 TUNIT8 = ' ' / physical units of field 8 HISTORY TBOUT /INNAME='3C286 .MULTI . 2' END COL. NO. 1 2 3 4 5 6 ROW SOURCE SUBARRAY ANTS TIME RAN IFS CHANS NUMBER DAYS ***BEGIN*PASS*** 1 0 0 7 -2.314815E-05 1 1 1 '' '' 9 9.990000E+02 1 0 2 0 0 7 -2.314815E-05 1 1 2 '' '' 10 9.990000E+02 1 0 3 0 0 7 -2.314815E-05 1 1 3 '' '' 11 9.990000E+02 1 0 4 0 0 8 -2.314815E-05 1 1 4 '' '' 9 9.990000E+02 1 0 -5 0 0 8 -2.314815E-05 1 1 -5 '' '' 10 9.990000E+02 1 0 6 0 0 8 -2.314815E-05 1 1 6 '' '' 11 9.990000E+02 1 0 7 0 0 20 -2.314815E-05 1 1 7 '' '' 21 9.990000E+02 1 0 ***END*PASS*** COL. NO. 7 8 ROW PFLAGS REASON NUMBER ***BEGIN*PASS*** 1 '1111' 'TBIN TBOUT TEST ' 2 '1111' 'TBIN TBOUT TEST ' 3 '1111' 'TBIN TBOUT TEST ' 4 '1111' 'TBIN TBOUT TEST ' -5 '1111' 'TBIN TBOUT TEST ' 6 '1111' 'TBIN TBOUT TEST ' 7 '1100' 'ANOTHER TBIN/OUT TEST ' ***END*PASS***