OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
read_discrete.f
Go to the documentation of this file.
1  subroutine read_discrete(bdat,dis,raw)
2 c this subroutine extracts the discrete value bdat from a byte
3 c using the location specified by dis in the array raw
4 c
5 c modification history
6 c
7 c changed integer*1 to byte for Sun OS compatibility, B. A. Franz,
8 c gac, november 14, 1997.
9 
10  integer*4 dis(3)
11  integer*2 mask(8),itmp2,idat
12  byte raw(*),bdat,temp2(2)
13  equivalence(temp2,itmp2)
14  data mask/128,64,32,16,8,4,2,1/
15 
16  idat = 0
17  itmp2 = 0
18 #ifdef LINUX
19  temp2(1) = raw(dis(1))
20 #else
21  temp2(2) = raw(dis(1))
22 #endif
23  do j=1,dis(3)
24  idat = idat + iand(itmp2,mask(dis(2)+j-1))
25  end do
26  bdat = idat/mask(dis(2)+dis(3)-1)
27  return
28  end
subroutine read_discrete(bdat, dis, raw)
Definition: read_discrete.f:2