aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/ptools/tbrenumber.cl
blob: 75778ac6815fb43dff7ebffe6369a52d9b8766fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# TBRENUMBER -- Renumber the ID column of an APPHOT/DAOPHOT STSDAS table
# database.

procedure tbrenumber (tables)

file	tables {prompt="Input apphot/daophot tables databases to be renumbered"}
int	idoffset	{0, min=0, prompt="Id number offset"}
string	id     		{"ID", prompt="Id name keyword"}

struct	*inlist

begin
	# Declare local variables.
	file ttables
	string tmpin, inname, expr

	# Get the positional parameters.
	ttables = tables
	expr = "rownum + " // idoffset

	tmpin = mktemp ("tmp$")
	files (ttables, sort=no, > tmpin)

	inlist = tmpin
	while (fscan (inlist, inname) != EOF) {
	    if (defpar ("tcalc.verbose") || defpar ("tcalc.harmless")) {
	        tcalc (inname, id, expr, datatype="real", colunits="",
	            colfmt="", verbose=no, harmless=0.1)
	    } else {
	        tcalc (inname, id, expr, datatype="real", colunits="",
	            colfmt="")
	    }
	}
	delete (tmpin, ver-, >& "dev$null")
	inlist = ""
end