aboutsummaryrefslogtreecommitdiff
path: root/vo/src/OLD/vizier.cl
diff options
context:
space:
mode:
Diffstat (limited to 'vo/src/OLD/vizier.cl')
-rw-r--r--vo/src/OLD/vizier.cl65
1 files changed, 65 insertions, 0 deletions
diff --git a/vo/src/OLD/vizier.cl b/vo/src/OLD/vizier.cl
new file mode 100644
index 00000000..bf9209ba
--- /dev/null
+++ b/vo/src/OLD/vizier.cl
@@ -0,0 +1,65 @@
+#{ VIZIER -- Call a service Vizier TABULARSKY service.
+
+procedure vizier (tab_id)
+
+string tab_id { prompt = "Table reference" }
+
+string output = "STDOUT" { prompt = "Output filename" }
+string otype = "ascii" { prompt = "Output format",
+ min="ascii|csv|votable|fits" }
+bool all = yes { prompt = "Get all matching tables?" }
+bool verbose = no { prompt = "Verbose output?" }
+
+int status = 0 { prompt = "Service status code" }
+
+begin
+ string id, url, oname, tname, ctype, oroot
+ string sfile, fields, catid, svc_type
+ bool verb, do_all
+ int fnum, nrecords
+
+
+ id = tab_id
+ ctype = otype
+ oroot = output
+ do_all = all
+ verb = verbose
+
+ svc_type = "tabularskyservice"
+ fields = "ServiceURL,Identifier"
+ fnum = 1
+
+
+ # Create a temporary url file and output name.
+ sfile = mktemp ("tmp$vizier")
+ tname = mktemp ("tmp$vizier") // ".xml"
+
+ if (do_all)
+ print (regResolver (id, svc_type, fields, -1), > sfile)
+ else
+ print (regResolver (id, svc_type, fields), > sfile)
+
+ nrecords = nresolved()
+
+ list = sfile
+ while (fscan (list, url, catid) != EOF) {
+
+ if (nrecords > 1)
+ oname = oroot // "." // fnum
+ else
+ oname = oroot
+
+ if (verb)
+ printf ("Downloading %s ... to %s\n", catid, oname)
+
+ # Call the Vizier service url
+ rawcaller (url, otype="votable", output=tname)
+
+ # Output the table.
+ tabout (tname, oname, ctype)
+
+ delete (tname, verify-)
+ fnum = fnum + 1
+ }
+
+end