UPP (develop)
Loading...
Searching...
No Matches
GET_BITS.f
Go to the documentation of this file.
1
35!-----------------------------------------------------------------------
49 SUBROUTINE get_bits(IBM,SGDS,LEN,MG,G,ISCALE,GROUND, &
50 GMIN,GMAX,NBIT)
51
52!
53 implicit none
54!
55 REal,DIMENSION(LEN),intent(in):: G
56 real,DIMENSION(LEN),intent(inout) :: GROUND
57 integer,DIMENSION(LEN),intent(in):: MG
58 integer,intent(in) :: IBM,LEN
59 integer,intent(inout) :: ISCALE,NBIT
60 real,intent(out) :: GMAX,GMIN
61 integer I1,I,IRETT
62 real SGDS
63! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
64! DETERMINE EXTREMES WHERE BITMAP IS ON
65!
66 IF(ibm==0) THEN
67 gmax=g(1)
68 gmin=g(1)
69 DO i=2,len
70 gmax=max(gmax,g(i))
71 gmin=min(gmin,g(i))
72 ENDDO
73 ELSE
74 i1=0
75 DO i=1,len
76 IF(mg(i)/=0.AND.i1==0) i1=i
77 ENDDO
78 IF(i1>0.AND.i1<=len) THEN
79 gmax=g(i1)
80 gmin=g(i1)
81 DO i=i1+1,len
82 IF(mg(i)/=0) THEN
83 gmax=max(gmax,g(i))
84 gmin=min(gmin,g(i))
85 ENDIF
86 ENDDO
87 ELSE
88 gmax=0.
89 gmin=0.
90 ENDIF
91 ENDIF
92!
93!
94!
95 CALL fndbit ( gmin, gmax, sgds, nbit, iscale, irett)
96! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
97 RETURN
98 END
99
128 SUBROUTINE fndbit ( rmin, rmax, rdb, nmbts, iscale, iret )
129 implicit none
130!
131 integer,intent(inout) :: iscale,nmbts
132 real,intent(inout) :: rmin,rmax,rdb
133 real :: range,rr,rng2,po,rln2
134 integer :: iret,icnt,ipo,le,ibin
135!
136 DATA rln2/0.69314718/
137!-----------------------------------------------------------------------
138 iret = 0
139 icnt = 0
140 iscale = 0
141 range = rmax - rmin
142 IF ( range <= 0.00 ) THEN
143 nmbts = 8
144 RETURN
145 END IF
146!*
147 IF ( rdb == 0.0 ) THEN
148 nmbts = 8
149 RETURN
150 ELSE IF ( rdb > 0.0 ) THEN
151 ipo = int(alog10( range ))
152 IF ( range < 1.00 ) ipo = ipo - 1
153 po = float(ipo) - rdb + 1.
154 iscale = - int( po )
155 rr = range * 10. ** ( -po )
156 nmbts = int( alog( rr ) / rln2 ) + 1
157 ELSE
158 ibin = nint( -rdb )
159 rng2 = range * 2. ** ibin
160 nmbts = int( alog( rng2 ) / rln2 ) + 1
161 END IF
162!*
163 IF(nmbts<=0) THEN
164 nmbts=0
165 IF(abs(rmin)>=1.) THEN
166 iscale=-int(alog10(abs(rmin)))
167 ELSE IF (abs(rmin)<1.0.AND.abs(rmin)>0.0) THEN
168 iscale=-int(alog10(abs(rmin)))+1
169 ELSE
170 iscale=0
171 ENDIF
172 ENDIF
173 RETURN
174 END
subroutine get_bits(ibm, sgds, len, mg, g, iscale, ground, gmin, gmax, nbit)
get_bits() computes number of bits and round field.
Definition GET_BITS.f:51
subroutine fndbit(rmin, rmax, rdb, nmbts, iscale, iret)
fndbit() computes the number of packing bits given the maximum number of significant digits to preser...
Definition GET_BITS.f:129