~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to applic/plot/libsrc/coord.for

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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)
 
4
C
 
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.
 
9
C
 
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.
 
14
C
 
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, 
 
18
C MA 02139, USA.
 
19
C
 
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 
 
26
C                       GERMANY
 
27
C===========================================================================
 
28
C
 
29
      SUBROUTINE BOXWTP(RBOUND,NPIX,START,STEP,IBOUND)
 
30
C+++
 
31
C.PURPOSE:  Compute pixel coordinates and check for legal boundaries     
 
32
C.AUTHOR:   Rein H. Warmels, ESO-Garching
 
33
C.COMMENTS: none
 
34
C.VERSION:  87???? RHW creation   
 
35
C.VERSION:  910115 RHW IMPICIT NONE added
 
36
C---
 
37
      IMPLICIT   NONE
 
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
 
43
C
 
44
      INTEGER    ISTAT,ERR1,ERR2
 
45
      CHARACTER  TEXT*37,TEXT1*43,TEXT2*43
 
46
C
 
47
      DATA       TEXT/'*** WARNING: One or more coordinates '/
 
48
      DATA       TEXT1/'fall(s) below frame boundaries'/
 
49
      DATA       TEXT2/'fall(s) beyond frame boundaries'/
 
50
      DATA       ERR1/0/
 
51
      DATA       ERR2/0/
 
52
 
53
C ***
 
54
      IBOUND(1) = (RBOUND(1)-START)/STEP+1
 
55
      IBOUND(2) = (RBOUND(2)-START)/STEP+1
 
56
C
 
57
      IF (IBOUND(1).LE.0.) THEN
 
58
         IBOUND(1) = 1.
 
59
         ERR1 = 1
 
60
      END IF
 
61
      IF (IBOUND(1).GT.FLOAT(NPIX)) THEN
 
62
         IBOUND(1) = FLOAT(NPIX)
 
63
         ERR2 = 1
 
64
      END IF
 
65
C
 
66
      IF (IBOUND(2).LE.0.) THEN
 
67
         IBOUND(2) = 1.
 
68
         ERR1 = 1
 
69
      END IF 
 
70
      IF (IBOUND(2).GT.FLOAT(NPIX)) THEN 
 
71
         IBOUND(2) = FLOAT(NPIX)
 
72
         ERR2 = 1
 
73
      END IF
 
74
C
 
75
      IF (ERR1.EQ.1) THEN
 
76
         CALL STTPUT(TEXT//TEXT1,ISTAT)
 
77
      ENDIF
 
78
      IF (ERR2.EQ.1) THEN
 
79
         CALL STTPUT(TEXT//TEXT2,ISTAT)
 
80
      ENDIF
 
81
C      
 
82
      RETURN                                                                 
 
83
      END
 
84
 
 
85
 
 
86
      SUBROUTINE BOXPTW(IBOUND,NPIX,START,STEP,RBOUND)
 
87
C+++ 
 
88
C.PURPOSE:  Compute world coordinates and check for legal boundaries     
 
89
C.AUTHOR:   Rein H. Warmels, ESO-Garching
 
90
C.COMMENTS: none
 
91
C.VERSION:  87???? RHW creation   
 
92
C.VERSION:  910115 RHW IMPICIT NONE added
 
93
C---
 
94
      IMPLICIT   NONE
 
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         
 
100
C
 
101
      INTEGER    ISTAT,ERR1,ERR2
 
102
      CHARACTER  TEXT*37,TEXT1*43,TEXT2*43
 
103
C
 
104
      DATA       TEXT/'*** WARNING: One or more coordinates '/
 
105
      DATA       TEXT1/'fall(s) below frame boundaries'/
 
106
      DATA       TEXT2/'fall(s) beyond frame boundaries'/
 
107
      DATA       ERR1/0/
 
108
      DATA       ERR2/0/
 
109
C
 
110
C ***
 
111
      IF (IBOUND(1).EQ.-1.) THEN                    !  first x coord. too low
 
112
         ERR1 = 1
 
113
         IBOUND(1) = 1.
 
114
      ENDIF
 
115
      IF (IBOUND(1).EQ.0.) THEN                     !  first x coord. too high
 
116
         ERR2 = 1
 
117
         IBOUND(1) = FLOAT(NPIX)
 
118
      ENDIF
 
119
 
120
      IF (IBOUND(2).EQ.-1.) THEN                    !  second x coord. too low 
 
121
         ERR1 = 1
 
122
         IBOUND(2) = 1.
 
123
      ENDIF
 
124
      IF (IBOUND(2).EQ.0.) THEN                     !  second x coord. too high
 
125
         ERR2 = 1
 
126
         IBOUND(2) = FLOAT(NPIX) 
 
127
      ENDIF
 
128
 
 
129
      RBOUND(1) = START + (IBOUND(1)-1.)*STEP
 
130
      RBOUND(2) = START + (IBOUND(2)-1.)*STEP
 
131
C
 
132
      IF (ERR1.EQ.1) THEN
 
133
         CALL STTPUT(TEXT//TEXT1,ISTAT)
 
134
      ENDIF
 
135
      IF (ERR2.EQ.1) THEN
 
136
         CALL STTPUT(TEXT//TEXT2,ISTAT)
 
137
      ENDIF
 
138
C      
 
139
 
 
140
      RETURN
 
141
      END
 
142
 
 
143
 
 
144
 
 
145
 
 
146