; TBIN ;--------------------------------------------------------------- ;! Reads a text file AIPS table into AIPS ;# TASK TABLE UTILITY ;----------------------------------------------------------------------- ;; Copyright (C) 1995, 1999, 2008-2009, 2012 ;; 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 ;----------------------------------------------------------------------- TBIN LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC TBIN : Task to Read AIPS tables from text files. OUTNAME Image name (name) OUTCLASS Image name (class) OUTSEQ 0.0 9999.0 Image name (seq. #) OUTDISK 0.0 9.0 Disk drive # INTEXT External text file name. BCOUNT 0.0 Begin Table record to Read ECOUNT 0.0 End Table record to Read ---------------------------------------------------------------- TBIN Type: Task Use: TBIN reads an AIPS table from an external text file. It needs to be in the format prepared by TBOUT (or a reasonable facsimile thereof). A new version of the table is always created. Adverbs: OUTNAME.....Image name (name). Standard defaults. OUTCLASS....Image name (class). Standard defaults. OUTSEQ......Image name (seq. #). 0 => highest. OUTDISK.....Disk drive # of image. 0 => any. INTEXT......External text file name. BCOUNT......First table record to read. 0 -> 1. ECOUNT......Last table record to read. 0 -> 100000000 ---------------------------------------------------------------- TBIN : 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 TBOUT 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 table listing. INTEXT One must supply the name of the external file via the AIPS adverb INTEXT. Examples: INTEXT='disk$res:[myarea.pgm]table.txt' (VMS) INTEXT='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 binary BINTABLE 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' AUTHOR = 'Glen Langston' / author of table REFERENC= 'A. J. (1989) 97:1283' / published reference END COL. NO. 1 2 3 4 5 6 ROW SOURCE SUBARRAY ANTS TIME RAN IFS CHANS NUMBER DAYS 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 999 1 0 3 0 0 7 -0.2314815E-04 1 1 3 '' '' 11 99.9E+01 1 0 4 0 0 8 -231.4815D-07 1 1 4 '' '' 9 999 1 0 -5 0 0 08 -0.00002314815 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*** The Table Rows have been jumbled to illustrate that the input is read in free format. ----------------------------------------------------------------