aboutsummaryrefslogtreecommitdiff
path: root/noao/imred/vtel/mrotlogr.cl
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/imred/vtel/mrotlogr.cl
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/imred/vtel/mrotlogr.cl')
-rw-r--r--noao/imred/vtel/mrotlogr.cl68
1 files changed, 68 insertions, 0 deletions
diff --git a/noao/imred/vtel/mrotlogr.cl b/noao/imred/vtel/mrotlogr.cl
new file mode 100644
index 00000000..1612d030
--- /dev/null
+++ b/noao/imred/vtel/mrotlogr.cl
@@ -0,0 +1,68 @@
+#{ MROTLOGR -- Read all the headers on a FITS tape and print out some
+# of the header information for each file. (for Carrington rotation maps)
+
+{
+ struct header, headline, tfile, irafname
+ struct avbzero, keyword
+ struct tape, outfile
+ struct *fp
+ int sfnum, efnum, filenum
+ bool append
+
+ if (!deftask ("rfits")) {
+ print ("Task rfits not loaded. Load dataio and then try again.")
+ bye
+ }
+
+ # Get the tape name and the output file name.
+ tape = gettape
+ outfile = getout
+
+ # Get the starting and ending file numbers for the log.
+ sfnum = getsfnum
+ efnum = getefnum
+
+ # Get the append flag.
+ append = getapp
+
+ if (!append) {
+ print ("File fname avbzero", >> outfile)
+ }
+
+ filenum = sfnum
+ while (YES) {
+
+ # Read the next fits header from the tape.
+ header = mktemp("temp")
+ fp = header
+ rfits (tape, filenum, make_image=no, long_header=yes, > header)
+
+ # Initialize the output variables.
+ tfile = " "
+ irafname = " "
+ avbzero = " "
+
+ # Now match keywords against this header to obtain needed output.
+ while (fscan (fp, headline) != EOF) {
+ keyword = substr(headline, 1, 8)
+ if (keyword == "File: mt")
+ tfile = substr(headline, 7, 15)
+ else if (keyword == "IRAFNAME")
+ irafname = substr(headline, 12, 20)
+ else if (keyword == "AV_BZERO")
+ avbzero = substr(headline, 19, 27)
+ else if (keyword == "L_ZERO ")
+ lzero = substr(headline, 19, 26)
+ else if (keyword == "End of d") {
+ print (headline, >> outfile)
+ delete (header, verify-)
+ bye
+ }
+ }
+ print (tfile, irafname, avbzero, >> outfile)
+ filenum = filenum + 1
+ delete (header, verify-)
+ if (filenum > efnum)
+ bye
+ }
+}