aboutsummaryrefslogtreecommitdiff
path: root/vendor/x11iraf/cdl/examples/fdisplay.f
blob: d14633f60d7f95ff93c25b33e76a13f4ac154b2d (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
C ========================================================================
C                                                                        =
C  FDISPLAY -- Example fortran program showing the use of the Client     =
C  Display Library (CDL) Fortran interface for displaying images.  In    =
C  this simple program all input is prompted for on the command line.    =
C                                                                        =
C ========================================================================


	program fdisplay
	character*132  	imname
        character*132	imtdev

C 	--------------------------
C 	Initialize the CDL package
C 	--------------------------
        call getenv('IMTDEV',imtdev)
        call cfopen(imtdev, ier)
	if (ier .gt. 0) then
	    write (*,*) 'open: Error return from CDL'
	    goto 999
	endif

        write (*, "('Image Name: ', $)")
        read (5, *) imname
        write (*, "('Frame Number: ', $)")
        read (5, *) iframe
        write (*, "('Frame buffer configuration number: ', $)")
        read (5, *) ifb

C 	----------------------------------------------------------
C	If we've got a FITS format image, go ahead and display it.
C 	----------------------------------------------------------
	call cfisfits (imname, isfits)
	if (isfits .gt. 0) then
	    call cfdisplayfits (imname, iframe, ifb, 1, ier)
	    if (ier .gt. 0) then
	        write (*,*) 'displayFITS: Error return from CDL'
	        goto 999
	    endif
	else 
C 	    --------------------------------------------------------
C	    We've got an IRAF format image, go ahead and display it.
C 	    --------------------------------------------------------
	    call cfisiraf (imname, isiraf)
	    if (isiraf .gt. 0) then
	        call cfdisplayiraf (imname, 1, iframe, ifb, 1, ier)
	        if (ier .gt. 0) then
	            write (*,*) 'displayIRAF: Error return from CDL'
	            goto 999
	        endif
	    else 
C 	    	----------------------------------
C	    	Unrecognized image, punt and exit.
C 	    	----------------------------------
	        write (*,*) 'Unrecognized image format'
	    endif
	endif

C 	------------------
C 	Clean up and exit.
C 	------------------
999	continue
	call cfclose (ier)
	end