32 lines
1003 B
Python
32 lines
1003 B
Python
import sys
|
|
import argparse
|
|
|
|
|
|
from obitools3.obidms.obidmscolumn.capidmscolumn import OBIDMS_column
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
parser = argparse.ArgumentParser(description='Computes the sum of a column.')
|
|
|
|
parser.add_argument('-d', '--dms', dest='dms_name', type=str,
|
|
help='Name of the OBIDMS containing the column')
|
|
parser.add_argument('-c', '--column', dest='column_name', type=str, default='count',
|
|
help="Name of the OBIDMS column (default: 'count')")
|
|
parser.add_argument('-v', '--version', dest='version_number', type=int, default=-1,
|
|
help='Version number of the column (default: latest version)')
|
|
|
|
args = parser.parse_args()
|
|
|
|
c = OBIDMS_column.open(args.dms_name, args.column_name, version_number=args.version_number)
|
|
|
|
# check that 1 element / line and summable type?
|
|
|
|
total = 0
|
|
|
|
for count in c :
|
|
total+=count
|
|
|
|
print("Total count = ", total)
|
|
|