3.2.1 Alternative table query function
Description
Make a table from a query applied to the current table. It is possible to specify
column(s) and/or expressions to sort on and to specify the columns to be
contained in the output table. See the example below. A new ”on-the-fly”
table tool is returned. The new (reference) table can be given a name and will
then be written to disk. Note that the resulting table is just a reference to the
original table. One can make a deep copy of the query result using the copy
function (see example).
Arguments
| Inputs |
| ||
| query |
| the query expression
| |
| allowed: | string |
|
| Default: |
|
|
| resultTable |
| Name of the results table
| |
| allowed: | string |
|
| Default: |
|
|
| sortlist |
| Sort list of the results table
| |
| allowed: | string |
|
| Default: |
|
|
| columns |
| Columns to return in the sort table, leave blank for all
| |
| allowed: | string |
|
| Default: |
|
|
Example
tb.open("3C273XC1.MS")
subt=tb.queryC("OBSERVATION_ID==0", sortlist="ARRAY_ID", columns="TIME, DATA, UVW") print subt.ncols() # 23 tb.close() copyt = subt.copy ("3C273XC1_spw1.MS", True) subt.close() copyt.close() |
From the original table corresponding to the disk file 3C273XC1.MS, only rows with OBSERVATION_ID equal to 0 are selected and sorted by ARRAY_ID. Only the columns TIME DATA UVW are written. Thereafter a deep copy of the result is made. The table queryC command is equivalent to:
SELECT TIME, DATA, UVW
FROM 3C273XC1.MS WHERE OBSERVATION_ID==0 ORDERBY ARRAY_ID |
Example
The sortlist argument can be used to sort in ascending or descending order (or
a mix of them) on one or more columns. Default is ascending. It is also possible
to remove duplicate values using the word NODUPLICATES at the beginning.
E.g.:
sortlist=’TIME desc’
sortlist=’noduplicates ANTENNA1,ANTENNA2’ sortlist=’ANTENNA1 desc, ANTENNA2 asc’ sortlist=’desc ANTENNA1, ANTENNA2, TIME’ |
Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu
Copyright © 2008 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search
Updated daily during alpha development.