1
C @(#)irasubs.for 19.1 (ES0-DMD) 02/25/03 13:23:49
2
C===========================================================================
3
C Copyright (C) 1995 European Southern Observatory (ESO)
5
C This program is free software; you can redistribute it and/or
6
C modify it under the terms of the GNU General Public License as
7
C published by the Free Software Foundation; either version 2 of
8
C the License, or (at your option) any later version.
10
C This program is distributed in the hope that it will be useful,
11
C but WITHOUT ANY WARRANTY; without even the implied warranty of
12
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
C GNU General Public License for more details.
15
C You should have received a copy of the GNU General Public
16
C License along with this program; if not, write to the Free
17
C Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
C Corresponding concerning ESO-MIDAS should be addressed as follows:
21
C Internet e-mail: midas@eso.org
22
C Postal address: European Southern Observatory
23
C Data Management Division
24
C Karl-Schwarzschild-Strasse 2
25
C D 85748 Garching bei Muenchen
27
C===========================================================================
29
character*(*) function object (text)
32
common /imid/ imdata, imcopy, dtype
33
if ((text(1:1) .eq. 'd') .or. (text(1:1) .eq. 'D')) then
35
else if ((text(1:1) .eq. 'c') .or. (text(1:1) .eq. 'C')) then
41
call imgkwc (i, 'title', line, ier)
43
call imgkwc (imdata, 'OBJECT', line, ier)
46
call imgkwc (i, 'COMMENT', line, ier)
53
if (line(i:i) .ne. ' ') then
64
subroutine attach (image, open)
65
character expand*100, message*64, object*64
66
character*30 image, coofil, magfil, psffil, profil,
67
. grpfil, switch, extend
68
integer axlen(7), dtype
70
common /filnam/ coofil, magfil, psffil, profil, grpfil
71
common /imid/ imdata, imcopy, dtype
72
common /size/ ncol, nrow
73
call imopen (expand(extend(image,'imh')), 1, imdata, ier)
76
call imgkwc (imdata, 'title', object, ier)
78
call imgkwc (imdata, 'OBJECT', object, ier)
81
call imgkwc (imdata, 'COMMENT', object, ier)
87
call imgsiz (imdata, axlen, naxis, dtype, ier)
89
call stupid (message(ier))
92
else if (naxis .eq. 1) then
99
write (6,611) ncol, nrow
100
611 format (38x, 'Picture size: ', 2i5)
101
coofil = switch(image, '.coo')
102
magfil = switch(image, '.ap')
103
psffil = switch(image, '.psf')
104
profil = switch(image, '.nst')
105
grpfil = switch(image, '.grp')
108
call stupid (message(ier))
115
character*80 function message (ier)
117
call imemsg (ier,error)
124
subroutine crepic (picture, type, ncol, nrow, ier)
127
character*30 picture, extend
131
common /imid/ imdata, imcopy, idtype
132
call imopen (expand(extend(picture, 'imh')), 1, imcopy, ier)
134
d call stupid ('Output image already exists')
136
d call getname ('New output file name:', new)
137
d if (new .eq. 'OVERWRITE') then
138
call imdele (picture, ier)
147
if ((type(1:1) .eq. 'R') .or. (type(1:1) .eq. 'r'))
149
call imcrea (picture, len, 2, idtype, ier)
150
if (ier .ne. 0) call stupid (message(ier))
151
call imopen (picture, 3, imcopy, ier)
152
if (ier .ne. 0) call stupid (message(ier))
153
call imhcpy (imdata, imcopy, ier)
154
if (ier .ne. 0) call stupid (message(ier))
160
subroutine coppic (picture, pix, ncol, nrow, ier)
165
common /imid/ imdata, imcopy, idtype
167
call imopen (picture, 3, j, ier)
169
d call stupid ('Output image already exists')
171
d call getname ('New output file name:', new)
172
d if (new .eq. 'OVERWRITE') then
173
call imdele (picture, ier)
180
call imopnc (picture, imdata, imcopy, ier)
181
if (ier .ne. 0) call stupid(message(ier))
183
call imgl2r (imdata, pix, j, ier)
184
if (ier .ne. 0) call stupid(message(ier))
185
call impl2r (imcopy, pix, j, ier)
186
if (ier .ne. 0) call stupid(message(ier))
193
subroutine rdaray (text, lx, ly, mx, my, nx, func, ier)
197
common /size/ ncol, nrow
198
common /imid/ imdata, imcopy, idtype
199
if (text .eq. 'DATA') then
213
call imgs2r (id, func(1,j), lx, mx, jy, jy, ier)
215
call stupid(message(ier))
216
write (6,*) 'rdaray: x =', lx, ' to', mx,
226
subroutine wraray (text, lx, ly, mx, my, maxx, func, ier)
229
real*4 func(maxx,*), row(4096)
230
common /size/ ncol, nrow
231
common /imid/ imdata, imcopy, idtype
232
if (text .eq. 'DATA') then
248
if (idtype .le. 3) then
249
row(i) = max(-32768., min(32767., func(i,j)))
253
if (idtype .le. 5) then
254
row(i) = anint(row(i))
257
call imps2r (id, row, lx, mx, jy, jy, ier)
259
call stupid(message(ier))
260
write (6,*) 'wraray: x =', lx, ' to', mx,
271
subroutine clpic (text)
273
common /imid/ imdata, imcopy, idtype
274
if (text .eq. 'DATA') then
279
call imclos (id, ier)
285
subroutine delpic (image, ier)
287
call imdele (image, ier)
293
subroutine writem (picture, label, type, string)
299
character expand*100, picture*30, extend*30,
300
. label*8, type*1, string*(*)
301
common /imid/ imdata, imcopy, dtype
302
call imopen (expand(extend(picture,'imh')), 3, imdata, istat)
303
if (istat .ne. 0) then
304
call stupid ('Error opening image.')
309
if ((type .eq. 'D') .or. (type .eq. 'd')) then
310
read (string,*,iostat=istat) double
311
if (istat .ne. 0) then
312
call stupid ('Error reading datum from string:')
316
call imakwd (imdata, label, double, ' ', istat)
317
if (istat .ne. 0) then
318
call stupid ('Error writing header item:')
319
write (6,*) label, '= ', double
322
call imclos (imdata, istat)
328
SUBROUTINE LIST (FILE)
331
WRITE (6,*) 'Image file = ', FILE