forked from avikhlinin/wvdecomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
o_f_i.f
70 lines (61 loc) · 1.54 KB
/
o_f_i.f
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
66
67
68
69
70
subroutine open_fits_image (
~ filename,
~ mode,
~ unit,
~ nx,ny,
~ bitpix,
~ status
~ )
implicit none
character filename*(*), mode*(*)
integer unit,nx,ny,bitpix,status
integer rwmode
integer naxis,pcount,gcount
integer naxes(10)
integer lnblnk
logical simple, extend
integer i
logical twodimage
call ftgiou (unit,status)
if (mode.eq.'rw'.or.mode.eq.'w') then
rwmode=1
else
rwmode=0
endif
* call ftopen (unit,filename,rwmode,blocksize,status)
call ftnopn (unit,filename,rwmode,status)
call ftghpr (unit,10,simple,bitpix,naxis,naxes,pcount,gcount,extend
~ ,status)
if (status.eq.0) then
call check_naxis(naxis,naxes,nx,ny,twodimage)
if (.not.twodimage) then
write(0,*) filename(1:lnblnk(filename)),': not a 2-D image'
write(0,*)(naxes(i),i=1,min(naxis,10))
call exit(1)
endif
* nx = naxes(1)
* ny = naxes(2)
endif
return
end
subroutine op_fits_img (filename,unit,nx,ny)
implicit none
character filename*(*)
integer unit
integer nx,ny
integer status,bitpix
status=0
call open_fits_image (
~ filename,
~ 'r',
~ unit,
~ nx,ny,
~ bitpix,
~ status
~ )
if (status.ne.0) then
call perror_fitsio (filename,status)
call exit(1)
endif
return
end