aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/ptools/tbrenumber.cl
diff options
context:
space:
mode:
Diffstat (limited to 'noao/digiphot/ptools/tbrenumber.cl')
-rw-r--r--noao/digiphot/ptools/tbrenumber.cl36
1 files changed, 36 insertions, 0 deletions
diff --git a/noao/digiphot/ptools/tbrenumber.cl b/noao/digiphot/ptools/tbrenumber.cl
new file mode 100644
index 00000000..75778ac6
--- /dev/null
+++ b/noao/digiphot/ptools/tbrenumber.cl
@@ -0,0 +1,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