1
C @(#)coord.for 19.1 (ES0-DMD) 02/25/03 13:19:39
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
SUBROUTINE BOXWTP(RBOUND,NPIX,START,STEP,IBOUND)
31
C.PURPOSE: Compute pixel coordinates and check for legal boundaries
32
C.AUTHOR: Rein H. Warmels, ESO-Garching
34
C.VERSION: 87???? RHW creation
35
C.VERSION: 910115 RHW IMPICIT NONE added
38
REAL RBOUND(2) ! IN: image pixel in world coordinates
39
INTEGER NPIX ! IN: number of pixels in the x direction
40
REAL START ! IN: start of image in x in world unit
41
REAL STEP ! IN: distance between x pixels in world unit
42
REAL IBOUND(2) ! OUT: image coordinate in pixel coordinates
44
INTEGER ISTAT,ERR1,ERR2
45
CHARACTER TEXT*37,TEXT1*43,TEXT2*43
47
DATA TEXT/'*** WARNING: One or more coordinates '/
48
DATA TEXT1/'fall(s) below frame boundaries'/
49
DATA TEXT2/'fall(s) beyond frame boundaries'/
54
IBOUND(1) = (RBOUND(1)-START)/STEP+1
55
IBOUND(2) = (RBOUND(2)-START)/STEP+1
57
IF (IBOUND(1).LE.0.) THEN
61
IF (IBOUND(1).GT.FLOAT(NPIX)) THEN
62
IBOUND(1) = FLOAT(NPIX)
66
IF (IBOUND(2).LE.0.) THEN
70
IF (IBOUND(2).GT.FLOAT(NPIX)) THEN
71
IBOUND(2) = FLOAT(NPIX)
76
CALL STTPUT(TEXT//TEXT1,ISTAT)
79
CALL STTPUT(TEXT//TEXT2,ISTAT)
86
SUBROUTINE BOXPTW(IBOUND,NPIX,START,STEP,RBOUND)
88
C.PURPOSE: Compute world coordinates and check for legal boundaries
89
C.AUTHOR: Rein H. Warmels, ESO-Garching
91
C.VERSION: 87???? RHW creation
92
C.VERSION: 910115 RHW IMPICIT NONE added
95
REAL IBOUND(2) ! IN: image coordinate in pixel coordinates
96
INTEGER NPIX ! IN: number of pixels in the x direction
97
REAL START ! IN: start of image in x in world unit
98
REAL STEP ! IN: distance between x pixels in world unit
99
REAL RBOUND(2) ! OUT:image pixel in world coordinates
101
INTEGER ISTAT,ERR1,ERR2
102
CHARACTER TEXT*37,TEXT1*43,TEXT2*43
104
DATA TEXT/'*** WARNING: One or more coordinates '/
105
DATA TEXT1/'fall(s) below frame boundaries'/
106
DATA TEXT2/'fall(s) beyond frame boundaries'/
111
IF (IBOUND(1).EQ.-1.) THEN ! first x coord. too low
115
IF (IBOUND(1).EQ.0.) THEN ! first x coord. too high
117
IBOUND(1) = FLOAT(NPIX)
120
IF (IBOUND(2).EQ.-1.) THEN ! second x coord. too low
124
IF (IBOUND(2).EQ.0.) THEN ! second x coord. too high
126
IBOUND(2) = FLOAT(NPIX)
129
RBOUND(1) = START + (IBOUND(1)-1.)*STEP
130
RBOUND(2) = START + (IBOUND(2)-1.)*STEP
133
CALL STTPUT(TEXT//TEXT1,ISTAT)
136
CALL STTPUT(TEXT//TEXT2,ISTAT)