88 SUBROUTINE w3fi75 (IBITL,ITYPE,ITOSS,FLD,IFLD,IBMAP,IBDSFL,
89 & NPTS,BDS11,IPFLD,PFLD,LEN,LENBDS,IBERR,PDS,IGDS)
99 character(len=1) IPFLD(*)
102 INTEGER IFLD(*),IGDS(*)
111 CHARACTER * 1 BDS11(11),PDS(*)
112 CHARACTER * 1 PFLD(*)
123 IF (itoss .EQ. 1)
THEN
124 IF (itype .EQ. 0)
THEN
126 IF (ibmap(it) .EQ. 1)
THEN
132 ELSE IF (itype .EQ. 1)
THEN
134 IF (ibmap(it) .EQ. 1)
THEN
144 ELSE IF (itoss .EQ. 0)
THEN
145 IF (itype .EQ. 0)
THEN
149 ELSE IF (itype .EQ. 1)
THEN
163 IF (itype .EQ. 0 .AND. ibitl .EQ. 0)
THEN
165 iwork(if) = nint(fwork(if))
167 ELSE IF (itype .EQ. 1 .AND. ibitl .NE. 0)
THEN
169 fwork(if) = float(iwork(if))
175 IF (ibdsfl(2).NE.0)
THEN
189 IF (iwork(i).LT.min)
THEN
191 ELSE IF (iwork(i).GT.max)
THEN
200 iwork(i) = iwork(i) - min
233 IF (fwork(i).LT.rmin)
THEN
235 ELSE IF (fwork(i).GT.rmax)
THEN
243 fwork(i) = fwork(i) - rmin
251 idelt = nint(rmax - rmin)
260 iscal2 = iwide - ibitl
269 iwork(i) = nint(fwork(i) * scal2)
282 CALL gbytec(pds,ipdsiz,0,24)
283 IF (ipdsiz.EQ.50)
THEN
291 CALL w3fi82 (iwork,fval1,fdiff1,npts,pds,igds)
318 fval1 = fval1 + refnce*scal2
322 IF (bit_size(lw).EQ.32)
THEN
323 CALL w3fi76 (fval1,iexp,imant,32)
325 CALL w3fi76 (fval1,iexp,imant,64)
327 CALL sbytec(pds,iexp,320,8)
328 CALL sbytec(pds,imant,328,24)
330 IF (bit_size(lw).EQ.32)
THEN
331 CALL w3fi76 (fdiff1,iexp,imant,32)
333 CALL w3fi76 (fdiff1,iexp,imant,64)
335 CALL sbytec(pds,iexp,352,8)
336 CALL sbytec(pds,imant,360,24)
342 CALL sbytec(pds,iscal2,384,16)
346 CALL sbytec( pds,iscal2,385,15)
352 IF (iwork(i).LT.min)
THEN
354 ELSE IF (iwork(i).GT.max)
THEN
360 iwork(i) = iwork(i) - min
375 ELSE IF (ibdsfl(2).EQ.1.AND.ibdsfl(7).EQ.0)
THEN
378 CALL fi7503 (iwork,ipfld,npts,ibdsfl,bds11,
379 * len,lenbds,pds,refnce,iscal2,kwide,igds)
391 CALL fi7501 (iwork,ipfld,npts,ibdsfl,bds11,
392 * len,lenbds,pds,refnce,iscal2,kwide)
408 CALL w3fi58(iwork,npts,iwork,pfld,nbits,len,kmin)
416 IF (len.EQ.0.AND.nbits.EQ.0) const = .true.
425 CALL w3fi59(fwork,npts,ibitl,iwork,pfld,iscale,len,rmin)
440 inum = npts * nbits + 88
447 inum = inum + 16 - nleft
459 CALL sbytec (bds11,lenbds,0,24)
463 CALL sbytec (bds11,ibdsfl(1),24,1)
464 CALL sbytec (bds11,ibdsfl(2),25,1)
465 CALL sbytec (bds11,ibdsfl(3),26,1)
466 CALL sbytec (bds11,ibdsfl(4),27,1)
468 CALL sbytec (bds11,nfill,28,4)
473 IF (iscale.LT.0)
THEN
474 CALL sbytec (bds11,1,32,1)
476 CALL sbytec (bds11,iscale,33,15)
478 CALL sbytec (bds11,iscale,32,16)
490 IF (bit_size(lw).EQ.32)
THEN
491 CALL w3fi76 (refnce,iexp,imant,32)
493 CALL w3fi76 (refnce,iexp,imant,64)
495 CALL sbytec (bds11,iexp,48,8)
496 CALL sbytec (bds11,imant,56,24)
502 CALL sbytec (bds11,nbits,80,8)
535 SUBROUTINE fi7501 (IWORK,IPFLD,NPTS,IBDSFL,BDS11,
536 * LEN,LENBDS,PDS,REFNCE,ISCAL2,KWIDE)
538 CHARACTER*1 BDS11(*),PDS(*)
544 CHARACTER(len=1) IPFLD(*)
560 character(len=1) ISOWID(400000)
562 character(len=1) ISOBMP(65600)
564 character(len=1) IFOVAL(400000)
566 character(len=1) ISOVAL(800000)
572 DATA ibits/1,3,7,15,31,63,127,255,511,1023,
573 * 2047,4095,8191,16383,32767,65535,131072,
574 * 262143,524287,1048575,2097151,4194303,
575 * 8388607,16777215,33554431,67108863,
576 * 134217727,268435455,536870911,
577 * 1073741823,2147483647/
628 IF (istart.GT.npts)
THEN
630 ELSE IF (istart.EQ.npts)
THEN
637 CALL fi7502 (iwork,istart,npts,isame)
638 IF (isame.GE.15)
THEN
646 CALL fi7513 (iwork,istart,npts,nmax,nmin,inrnge)
648 iend = istart + inrnge - 1
658 kbds(17) = kbds(17) + 1
660 IF (mxdiff.GT.0)
THEN
661 DO 2220 lk = 0, kpts-1
662 iwork(istart+lk) = iwork(istart+lk) - nmin
664 CALL sbytec (ifoval,nmin,ifoptr,kbds(11))
666 CALL sbytec (ifoval,iwork(istart),ifoptr,kbds(11))
668 ifoptr = ifoptr + kbds(11)
670 IF (mxdiff.GT.0)
THEN
671 DO 2330 kwide = 1, 31
672 IF (mxdiff.LE.ibits(kwide))
THEN
680 CALL sbytec (isowid,kwide,iwdptr,8)
685 CALL sbytesc (isoval,iwork(istart),isoptr,kwide,0,kpts)
686 isoptr = isoptr + kpts * kwide
687 kbds(19) = kbds(19) + kpts
692 CALL sbytec (isobmp,1,ibmp2p,1)
693 ibmp2p = ibmp2p + kpts
694 istart = istart + kpts
710 CALL sbytec (ipfld,ibdsfl(5),iptr,1)
712 CALL sbytec (ipfld,ibdsfl(6),iptr,1)
714 CALL sbytec (ipfld,ibdsfl(7),iptr,1)
716 CALL sbytec (ipfld,ibdsfl(8),iptr,1)
718 CALL sbytec (ipfld,ibdsfl(9),iptr,1)
720 CALL sbytec (ipfld,ibdsfl(10),iptr,1)
722 CALL sbytec (ipfld,ibdsfl(11),iptr,1)
724 CALL sbytec (ipfld,ibdsfl(12),iptr,1)
731 CALL sbytec (ipfld,kbds(17),iptr,16)
735 CALL sbytec (ipfld,kbds(19),iptr,16)
738 CALL sbytec (ipfld,0,iptr,8)
742 ix = (iwdptr + 32) / 32
746 ipfld(jst:jst+ijk)=isowid(1:ijk)
749 ij = (ibmp2p + 32) / 32
753 ipfld(jst:jst+ijk)=isobmp(1:ijk)
755 IF (mod(iptr,8).NE.0)
THEN
756 iptr = iptr + 8 - mod(iptr,8)
760 kbds(12) = iptr / 8 + 12
762 CALL sbytec (ipfld,kbds(12),0,16)
764 ipass = (ifoptr + 32) / 32
768 ipfld(jst:jst+ijk)=ifoval(1:ijk)
770 IF (mod(iptr,8).NE.0)
THEN
771 iptr = iptr + 8 - mod(iptr,8)
776 kbds(15) = iptr / 8 + 12
778 CALL sbytec (ipfld,kbds(15),24,16)
780 ix = (isoptr + 32) / 32
784 ipfld(jst:jst+ijk)=isoval(1:ijk)
786 nleft = mod(iptr+88,16)
799 CALL sbytec (bds11,lenbds,0,24)
801 CALL sbytec (bds11,ibdsfl(1),24,1)
802 CALL sbytec (bds11,ibdsfl(2),25,1)
803 CALL sbytec (bds11,ibdsfl(3),26,1)
804 CALL sbytec (bds11,ibdsfl(4),27,1)
806 CALL sbytec (bds11,nleft,28,4)
808 IF (iscal2.LT.0)
THEN
809 CALL sbytec (bds11,1,32,1)
812 CALL sbytec (bds11,0,32,1)
814 CALL sbytec (bds11,iscal2,33,15)
823 IF (bit_size(lw).EQ.32)
THEN
824 CALL w3fi76 (refnce,iexp,imant,32)
826 CALL w3fi76 (refnce,iexp,imant,64)
828 CALL sbytec (bds11,iexp,48,8)
829 CALL sbytec (bds11,imant,56,24)
833 CALL sbytec (bds11,kbds(11),80,8)
856 SUBROUTINE fi7502 (IWORK,ISTART,NPTS,ISAME)
865 DO 100 k = istart, npts
866 IF (iwork(k).NE.iwork(istart))
THEN
900 SUBROUTINE fi7503 (IWORK,IPFLD,NPTS,IBDSFL,BDS11,
901 * LEN,LENBDS,PDS,REFNCE,ISCAL2,KWIDE,IGDS)
903 CHARACTER*1 BDS11(*),PDS(*),IPFLD(*)
925 character(len=1) ISOWID(400000)
927 character(len=1) ISOBMP(65600)
929 character(len=1) IFOVAL(400000)
931 character(len=1) ISOVAL(800000)
968 IF (iand(igds(13),32).NE.0)
THEN
984 4101
FORMAT (1x,25i4)
994 CALL sbytec (isobmp,1,ibmp2p,1)
996 CALL sbytec (isobmp,0,ibmp2p,1)
1001 len = ibmp2p / 32 + 1
1012 lowest = iwork(jptr)
1014 IF (iwork(jptr).LT.lowest)
THEN
1015 lowest = iwork(jptr)
1020 CALL sbytec (ifoval,lowest,ifoptr,kwide)
1021 ifoptr = ifoptr + kwide
1026 ibig = iwork(jptr) - lowest
1028 iwork(jptr) = iwork(jptr) - lowest
1029 IF (iwork(jptr).GT.ibig)
THEN
1038 CALL sbytec (isowid,nwide,iwdptr,8)
1043 DO 5000 j = 0, kin-1
1044 CALL sbytec (isoval,iwork(kptr+j),isoptr,nwide)
1045 isoptr = isoptr + nwide
1060 CALL sbytec (ipfld,ibdsfl(5),iptr,1)
1062 CALL sbytec (ipfld,ibdsfl(6),iptr,1)
1064 CALL sbytec (ipfld,ibdsfl(7),iptr,1)
1066 CALL sbytec (ipfld,ibdsfl(8),iptr,1)
1068 CALL sbytec (ipfld,ibdsfl(9),iptr,1)
1070 CALL sbytec (ipfld,ibdsfl(10),iptr,1)
1072 CALL sbytec (ipfld,ibdsfl(11),iptr,1)
1074 CALL sbytec (ipfld,ibdsfl(12),iptr,1)
1081 CALL sbytec (ipfld,kbds(17),iptr,16)
1085 CALL sbytec (ipfld,kbds(19),iptr,16)
1088 CALL sbytec (ipfld,0,iptr,8)
1092 ix = (iwdptr + 32) / 32
1096 ipfld(jst:jst+ijk)=isowid(1:ijk)
1097 iptr = iptr + iwdptr
1105 kbds(12) = iptr / 8 + 12
1107 CALL sbytec (ipfld,kbds(12),0,16)
1109 ipass = (ifoptr + 32) / 32
1113 ipfld(jst:jst+ijk)=ifoval(1:ijk)
1114 iptr = iptr + ifoptr
1117 IF (mod(iptr,8).NE.0)
THEN
1118 iptr = iptr + 8 - mod(iptr,8)
1123 kbds(15) = iptr / 8 + 12
1125 CALL sbytec (ipfld,kbds(15),24,16)
1127 ix = (isoptr + 32) / 32
1131 ipfld(jst:jst+ijk)=isoval(1:ijk)
1132 iptr = iptr + isoptr
1135 nleft = mod(iptr+88,16)
1136 IF (nleft.NE.0)
THEN
1148 CALL sbytec (bds11,lenbds,0,24)
1150 CALL sbytec (bds11,ibdsfl(1),24,1)
1151 CALL sbytec (bds11,ibdsfl(2),25,1)
1152 CALL sbytec (bds11,ibdsfl(3),26,1)
1153 CALL sbytec (bds11,ibdsfl(4),27,1)
1155 CALL sbytec (bds11,nleft,28,4)
1157 IF (iscal2.LT.0)
THEN
1158 CALL sbytec (bds11,1,32,1)
1161 CALL sbytec (bds11,0,32,1)
1163 CALL sbytec (bds11,iscal2,33,15)
1172 IF (bit_size(lw).EQ.32)
THEN
1173 CALL w3fi76 (refnce,iexp,imant,32)
1175 CALL w3fi76 (refnce,iexp,imant,64)
1177 CALL sbytec (bds11,iexp,48,8)
1178 CALL sbytec (bds11,imant,56,24)
1182 CALL sbytec (bds11,kbds(11),80,8)
1184 klen = lenbds / 4 + 1
1212 DATA ibits/1,3,7,15,31,63,127,255,511,1023,2047,
1213 * 4095,8191,16383,32767,65535,131071,262143,
1214 * 524287,1048575,2097151,4194303,8388607,
1215 * 16777215,33554431,67108863,134217727,268435455,
1216 * 536870911,1073741823,2147483647/
1219 DO 1000 nbits = 1, 31
1220 IF (n.LE.ibits(nbits))
THEN
1247 SUBROUTINE fi7513 (IWORK,ISTART,NPTS,MAX,MIN,INRNGE)
1249 INTEGER IWORK(*),NPTS,ISTART,INRNGE,INRNGA,INRNGB
1250 INTEGER MAX,MIN,MXVAL,MAXB,MINB,MXVALB
1253 DATA ibits/1,3,7,15,31,63,127,255,511,1023,2047,
1254 * 4095,8191,16383,32767,65535,131071,262143,
1255 * 524287,1048575,2097151,4194303,8388607,
1256 * 16777215,33554431,67108863,134217727,268435455,
1257 * 536870911,1073741823,2147483647/
1265 CALL fi7516 (iwork,npts,inrnga,istrta,
1266 * max,min,mxval,lwide)
1269 istrtb = istrta + inrnga
1272 IF (istrtb.GT.npts)
THEN
1278 CALL fi7502 (iwork,istrtb,npts,isame)
1279 IF (isame.GE.15)
THEN
1289 istrtb = istrta + inrnga
1290 CALL fi7516 (iwork,npts,inrngb,istrtb,
1291 * maxb,minb,mxvalb,lwideb)
1297 ktrnd = lwide - lwideb
1299 IF (ktrnd.LE.0)
THEN
1301 mxval = ibits(lwide)
1310 CALL fi7518 (iret,iwork,npts,istrta,inrnga,inrngb,
1311 * max,min,lwide,mxval)
1312 IF(iret.EQ.1)
GO TO 8000
1314 IF (inrngb.LT.20)
THEN
1321 mxvalb = ibits(lwideb)
1328 CALL fi7517 (iret,iwork,npts,istrtb,inrnga,
1329 * maxb,minb,lwideb,mxvalb)
1330 IF(iret.EQ.1)
GO TO 8000
1370 SUBROUTINE fi7516 (IWORK,NPTS,INRNG,ISTART,MAX,MIN,MXVAL,LWIDTH)
1372 INTEGER IWORK(*),NPTS,ISTART,INRNG,MAX,MIN,LWIDTH,MXVAL
1375 DATA ibits/1,3,7,15,31,63,127,255,511,1023,2047,
1376 * 4095,8191,16383,32767,65535,131071,262143,
1377 * 524287,1048575,2097151,4194303,8388607,
1378 * 16777215,33554431,67108863,134217727,268435455,
1379 * 536870911,1073741823,2147483647/
1386 DO 1000 i = istart+1, jq
1387 CALL fi7502 (iwork,i,npts,isame)
1388 IF (isame.GE.15)
THEN
1392 IF (iwork(i).GT.max)
THEN
1394 ELSE IF (iwork(i).LT.min)
THEN
1401 DO 9000 lwidth = 1, 31
1402 IF (krng.LE.ibits(lwidth))
THEN
1433 SUBROUTINE fi7517 (IRET,IWORK,NPTS,ISTRTB,INRNGA,
1434 * MAXB,MINB,MXVALB,LWIDEB)
1436 INTEGER IWORK(*),NPTS,ISTRTB,INRNGA
1437 INTEGER MAXB,MINB,LWIDEB,MXVALB
1440 DATA ibits/1,3,7,15,31,63,127,255,511,1023,2047,
1441 * 4095,8191,16383,32767,65535,131071,262143,
1442 * 524287,1048575,2097151,4194303,8388607,
1443 * 16777215,33554431,67108863,134217727,268435455,
1444 * 536870911,1073741823,2147483647/
1455 IF (itst.LE.kset)
THEN
1456 IF (iwork(npos).GT.maxb)
THEN
1457 IF ((iwork(npos)-minb).GT.mxvalb)
THEN
1464 ELSE IF (iwork(npos).LT.minb)
THEN
1465 IF ((maxb-iwork(npos)).GT.mxvalb)
THEN
1510 SUBROUTINE fi7518 (IRET,IWORK,NPTS,ISTRTA,INRNGA,INRNGB,
1511 * MAXA,MINA,LWIDEA,MXVALA)
1513 INTEGER IWORK(*),NPTS,ISTRTA,INRNGA
1514 INTEGER MAXA,MINA,LWIDEA,MXVALA
1517 DATA IBITS/1,3,7,15,31,63,127,255,511,1023,2047,
1518 * 4095,8191,16383,32767,65535,131071,262143,
1519 * 524287,1048575,2097151,4194303,8388607,
1520 * 16777215,33554431,67108863,134217727,268435455,
1521 * 536870911,1073741823,2147483647/
1525 npos = istrta + inrnga
1530 IF (itst.LE.inrngb)
THEN
1532 IF (iwork(npos).GT.maxa)
THEN
1533 IF ((iwork(npos)-mina).GT.mxvala)
THEN
1540 ELSE IF (iwork(npos).LT.mina)
THEN
1541 IF ((maxa-iwork(npos)).GT.mxvala)
THEN
subroutine gbytec(in, iout, iskip, nbyte)
Wrapper for gbytesc() limiting NSKIP and N to 0 and 1.
subroutine sbytec(out, in, iskip, nbyte)
This is a wrapper for sbytesc()
subroutine sbytesc(out, in, iskip, nbyte, nskip, n)
Store bytes - pack bits: Put arbitrary size values into a packed bit string, taking the low order bit...
subroutine w3fi58(ifield, npts, nwork, npfld, nbits, len, kmin)
Converts an array of integer numbers into an array of positive differences (number(s) - minimum value...
subroutine w3fi59(field, npts, nbits, nwork, npfld, iscale, len, rmin)
Converts an array of single precision real numbers into an array of positive scaled differences (numb...
subroutine fi7513(iwork, istart, npts, max, min, inrnge)
Select block of data for packing.
subroutine w3fi75(ibitl, itype, itoss, fld, ifld, ibmap, ibdsfl, npts, bds11, ipfld, pfld, len, lenbds, iberr, pds, igds)
This routine packs a grib field and forms octets(1-11) of the binary data section (bds).
subroutine fi7518(iret, iwork, npts, istrta, inrnga, inrngb, maxa, mina, lwidea, mxvala)
Scan forward.
subroutine fi7517(iret, iwork, npts, istrtb, inrnga, maxb, minb, mxvalb, lwideb)
Scan backward.
subroutine fi7501(iwork, ipfld, npts, ibdsfl, bds11, len, lenbds, pds, refnce, iscal2, kwide)
BDS second order packing.
subroutine fi7503(iwork, ipfld, npts, ibdsfl, bds11, len, lenbds, pds, refnce, iscal2, kwide, igds)
Row by row, col by col packing.
subroutine fi7502(iwork, istart, npts, isame)
Second order same value collection.
subroutine fi7505(n, nbits)
Determine number of bits to contain value.
subroutine fi7516(iwork, npts, inrng, istart, max, min, mxval, lwidth)
Scan number of points.
subroutine w3fi76(pval, kexp, kmant, kbits)
Converts floating point number from machine representation to grib representation (ibm370 32 bit f....
subroutine w3fi82(ifld, fval1, fdiff1, npts, pds, igds)
Accept an input array, convert to array of second differences.