ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/JSOC/proj/flatfield/pzt_flat_IDL/fits_help.pro
Revision: 1.1
Committed: Tue Feb 22 04:26:53 2011 UTC (12 years, 7 months ago) by richard
Branch: MAIN
CVS Tags: Ver_6-0, Ver_6-1, Ver_6-2, Ver_6-3, Ver_6-4, Ver_9-1, Ver_5-14, Ver_5-13, Ver_LATEST, Ver_9-3, Ver_9-41, Ver_9-2, Ver_8-8, Ver_8-2, Ver_8-3, Ver_8-0, Ver_8-1, Ver_8-6, Ver_8-7, Ver_8-4, Ver_8-5, Ver_7-1, Ver_7-0, Ver_9-5, Ver_9-4, Ver_8-10, Ver_8-11, Ver_8-12, Ver_9-0, HEAD
Log Message:
2011.02.21
fixed issues with fits library.

File Contents

# Content
1 pro fits_help,file_or_fcb
2 ;+
3 ; NAME:
4 ; FITS_HELP
5 ;
6 ; PURPOSE:
7 ; To print a summary of the primary data units and extensions in a
8 ; FITS file.
9 ;;
10 ; CALLING SEQUENCE:
11 ; FITS_HELP,filename_or_fcb
12 ;
13 ; INPUTS:
14 ; FILENAME_OR_FCB - name of the fits file or the FITS Control Block (FCB)
15 ; structure returned by FITS_OPEN. The file name is allowed
16 ; to be gzip compressed (with a .gz extension)
17 ;
18 ; OUTPUTS:
19 ; A summary of the FITS file is printed. For each extension, the values
20 ; of the XTENSION, EXTNAME EXTVER EXTLEVEL BITPIX GCOUNT, PCOUNT NAXIS
21 ; and NAXIS* keywords are displayed.
22 ;
23 ;
24 ; EXAMPLES:
25 ; FITS_HELP,'myfile.fits'
26 ;
27 ; FITS_OPEN,'anotherfile.fits',fcb
28 ; FITS_HELP,fcb
29 ;
30 ; PROCEDURES USED:
31 ; FITS_OPEN, FITS_CLOSE
32 ; HISTORY:
33 ; Written by: D. Lindler August, 1995
34 ; Converted to IDL V5.0 W. Landsman September 1997
35 ; Don't truncate EXTNAME values at 10 chars W. Landsman Feb. 2005
36 ;-
37 ;-----------------------------------------------------------------------------
38 compile_opt idl2
39 ;
40 ; print calling sequence
41 ;
42 if N_params() eq 0 then begin
43 print,'Syntax - FITS_HELP,file_or_fcb'
44 return
45 endif
46 ;
47 ; Open file if file name is supplied
48 ;
49 fcbtype = size(file_or_fcb,/type)
50 fcbsize = n_elements(file_or_fcb)
51 if (fcbsize ne 1) or ((fcbtype ne 7) and (fcbtype ne 8)) then begin
52 message, 'Invalid Filename or FCB supplied',/con
53 return
54 end
55
56 if fcbtype eq 7 then fits_open,file_or_fcb,fcb $
57 else fcb = file_or_fcb
58
59 ; EXTNAME will always be displayed with a length of at least 10 characters
60 ; but allow for possibility that lengths might be longer than this
61
62 maxlen = max(strlen(fcb.extname)) > 10
63 if maxlen EQ 10 then space = '' else $
64 space = string(replicate(32b, maxlen -10))
65 ;
66 ; print headings
67 ;
68 print,' '
69 print,FCB.FILENAME
70 print,' '
71 print,' XTENSION EXTNAME '+ space + $
72 'EXTVER EXTLEVEL BITPIX GCOUNT PCOUNT NAXIS NAXIS*'
73 print,' '
74 ;
75 ; loop on extensions
76 ;
77 for i=0,fcb.nextend do begin
78 st = string(i,'(I4)')
79 ;
80 ; xtension, extname, extver, extlevel (except for i=0)
81 ;
82 if i gt 0 then begin
83 t = fcb.xtension[i]
84 while strlen(t) lt 8 do t = t + ' '
85 st = st + ' '+ strmid(t,0,8)
86 t = fcb.extname[i]
87 while strlen(t) lt maxlen do t = t + ' '
88 st = st + ' '+ strmid(t,0,maxlen)
89 t = fcb.extver[i]
90 if t eq 0 then st = st + ' ' $
91 else st = st + string(t,'(I5)')
92 t = fcb.extlevel[i]
93 if t eq 0 then st = st + ' ' $
94 else st = st + string(t,'(I8)')
95 end else st = st + ' ' + space
96 ;
97 ; bitpix, gcount, pcount, naxis
98 ;
99 st = st + string(fcb.bitpix[i],'(I6)')
100 st = st + string(fcb.gcount[i],'(I7)')
101 st = st + string(fcb.pcount[i],'(I7)')
102 st = st + string(fcb.naxis[i],'(I6)')
103 ;
104 ; naxis*
105 ;
106 st = st + ' '
107 if fcb.naxis[i] gt 0 then begin
108 nax1 = fcb.naxis[i] - 1
109 st = st + strjoin(strtrim(fcb.axis[0:nax1,i],2),' x ')
110 endif
111 ;
112 ; print the info
113 ;
114 print,st
115 end
116 if fcbtype eq 7 then fits_close,fcb
117 return
118 end