UPP v11.0.0
Loading...
Searching...
No Matches
GET_BITS.f
Go to the documentation of this file.
1
35 SUBROUTINE get_bits(IBM,SGDS,LEN,MG,G,ISCALE,GROUND, &
36 GMIN,GMAX,NBIT)
37
38!
39 implicit none
40!
41 REal,DIMENSION(LEN),intent(in):: G
42 real,DIMENSION(LEN),intent(inout) :: GROUND
43 integer,DIMENSION(LEN),intent(in):: MG
44 integer,intent(in) :: IBM,LEN
45 integer,intent(inout) :: ISCALE,NBIT
46 real,intent(out) :: GMAX,GMIN
47 integer I1,I,IRETT
48 real SGDS
49! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50! DETERMINE EXTREMES WHERE BITMAP IS ON
51!
52 IF(ibm==0) THEN
53 gmax=g(1)
54 gmin=g(1)
55 DO i=2,len
56 gmax=max(gmax,g(i))
57 gmin=min(gmin,g(i))
58 ENDDO
59 ELSE
60 i1=0
61 DO i=1,len
62 IF(mg(i)/=0.AND.i1==0) i1=i
63 ENDDO
64 IF(i1>0.AND.i1<=len) THEN
65 gmax=g(i1)
66 gmin=g(i1)
67 DO i=i1+1,len
68 IF(mg(i)/=0) THEN
69 gmax=max(gmax,g(i))
70 gmin=min(gmin,g(i))
71 ENDIF
72 ENDDO
73 ELSE
74 gmax=0.
75 gmin=0.
76 ENDIF
77 ENDIF
78!
79!
80!
81 CALL fndbit ( gmin, gmax, sgds, nbit, iscale, irett)
82! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83 RETURN
84 END
85
114 SUBROUTINE fndbit ( rmin, rmax, rdb, nmbts, iscale, iret )
115 implicit none
116!
117 integer,intent(inout) :: iscale,nmbts
118 real,intent(inout) :: rmin,rmax,rdb
119 real :: range,rr,rng2,po,rln2
120 integer :: iret,icnt,ipo,le,ibin
121!
122 DATA rln2/0.69314718/
123!-----------------------------------------------------------------------
124 iret = 0
125 icnt = 0
126 iscale = 0
127 range = rmax - rmin
128 IF ( range <= 0.00 ) THEN
129 nmbts = 8
130 RETURN
131 END IF
132!*
133 IF ( rdb == 0.0 ) THEN
134 nmbts = 8
135 RETURN
136 ELSE IF ( rdb > 0.0 ) THEN
137 ipo = int(alog10( range ))
138 IF ( range < 1.00 ) ipo = ipo - 1
139 po = float(ipo) - rdb + 1.
140 iscale = - int( po )
141 rr = range * 10. ** ( -po )
142 nmbts = int( alog( rr ) / rln2 ) + 1
143 ELSE
144 ibin = nint( -rdb )
145 rng2 = range * 2. ** ibin
146 nmbts = int( alog( rng2 ) / rln2 ) + 1
147 END IF
148!*
149 IF(nmbts<=0) THEN
150 nmbts=0
151 IF(abs(rmin)>=1.) THEN
152 iscale=-int(alog10(abs(rmin)))
153 ELSE IF (abs(rmin)<1.0.AND.abs(rmin)>0.0) THEN
154 iscale=-int(alog10(abs(rmin)))+1
155 ELSE
156 iscale=0
157 ENDIF
158 ENDIF
159 RETURN
160 END
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:115