23 integer,
intent(in) :: ifl1,ifl2
25 CHARACTER(len=1),
allocatable,
dimension(:) :: cgrib
27 integer,
dimension(200) :: jids,jpdt,jgdt
28 integer :: kpds(200),kgds(200),kens(200),kprob(2)
29 integer :: kclust(16),kmembr(80)
31 integer :: igds(5)=(/0,0,0,0,0/)
33 logical :: unpack=.true.
47 call getgb2(ifl1,ifli1,jskp,jdisc,jids,jpdtn,jpdt,jgdtn,jgdt, &
48 unpack,jskp,gfld,iret)
51 print *,
' getgb2 error = ',iret
60 if (newlen.gt.currlen)
then
61 if (
allocated(cgrib))
deallocate(cgrib)
62 allocate(cgrib(newlen),stat=is)
70 igds(3)=gfld%numoct_opt
71 igds(4)=gfld%interp_opt
73 if (.NOT.
associated(gfld%list_opt)) &
74 allocate(gfld%list_opt(1))
75 call gdt2gds(igds,gfld%igdtmpl,gfld%num_opt,gfld%list_opt, &
78 print *,
'cnv21: could not create gds'
85 call makepds(gfld%discipline,gfld%idsect,gfld%ipdtnum, &
86 gfld%ipdtmpl,gfld%ibmap,gfld%idrtnum, &
87 gfld%idrtmpl,kpds,iret)
89 print *,
'cnv21: could not create pds in GRIB1'
100 if (kpds(1).eq.7.AND.kpds(2).eq.121) kpds(3)=238
101 if (kpds(1).eq.7.AND.kpds(2).eq.123) kpds(3)=244
102 if (kpds(1).eq.74)
then
103 if (kpds(2).eq.45.AND.kpds(3).eq.2) kpds(3)=2
104 if (kpds(2).eq.15.AND.kpds(3).eq.45) kpds(3)=45
105 if (kpds(2).eq.45.AND.kpds(3).eq.45) kpds(3)=45
110 if ((gfld%ipdtnum.ge.1.AND.gfld%ipdtnum.le.6).OR. &
111 (gfld%ipdtnum.ge.9.AND.gfld%ipdtnum.le.14))
then
112 call makepdsens(gfld%ipdtnum,gfld%ipdtmpl,kpds,kens,kprob, &
113 xprob,kclust,kmembr,iret)
118 if (gfld%ibmap.ne.0 .AND. gfld%ibmap.ne.254)
then
120 if ((gfld%idrtnum.eq.2 .OR. gfld%idrtnum.eq.3) .AND. &
121 gfld%idrtmpl(7).ne.0)
then
122 allocate(gfld%bmap(gfld%ngrdpts))
123 kpds(4)=ior(kpds(4),64)
124 if (gfld%idrtmpl(7).eq.1)
then
125 call rdieee(gfld%idrtmpl(8),rmiss1,1)
127 if (gfld%fld(i) .eq. rmiss1)
then
134 if (gfld%idrtmpl(7).eq.2)
then
135 call rdieee(gfld%idrtmpl(8),rmiss1,1)
136 call rdieee(gfld%idrtmpl(9),rmiss2,1)
138 if (gfld%fld(i).eq.rmiss1 .OR. &
139 gfld%fld(i).eq.rmiss2)
then
147 if ((gfld%idrtnum.eq.2 .OR. gfld%idrtnum.eq.3) .AND. &
148 gfld%idrtmpl(7).eq.0)
then
149 allocate(gfld%bmap(gfld%ngrdpts))
150 kpds(4)=ior(kpds(4),64)
151 call rdieee(gfld%idrtmpl(8),rmiss1,1)
152 if (rmiss1 .lt. -9999.0)
then
158 if (gfld%fld(i) .eq. rmiss1)
then
171 if (.NOT.
associated(gfld%bmap))
allocate(gfld%bmap(1))
173 call putgbexn(ifl2,gfld%ngrdpts,kpds,kgds,kens,kprob, &
174 xprob,kclust,kmembr,ibs,imug,gfld%bmap, &
178 print *,
' putgbexn error = ',iret
187 if (
allocated(cgrib))
deallocate(cgrib)
264subroutine makepds(idisc,idsect,ipdsnum,ipdstmpl,ibmap, &
265 idrsnum,idrstmpl,kpds,iret)
269 integer,
intent(in) :: idsect(*),ipdstmpl(*),idrstmpl(*)
270 integer,
intent(in) :: ipdsnum,idisc,idrsnum,ibmap
271 integer,
intent(out) :: kpds(*)
272 integer,
intent(out) :: iret
277 if ( (ipdsnum.lt.0).OR.(ipdsnum.gt.15) )
then
278 print *,
'makepds: Don:t know GRIB2 PDT 4.',ipdsnum
287 if ( ibmap.ne.255 ) kpds(4)=kpds(4)+64
288 if ( ibmap.ge.1.AND.ibmap.le.253 )
then
289 print *,
'makepds: Don:t know about predefined bit-map ',ibmap
298 If (ipdstmpl(16).eq.2.and.ipdstmpl(1).eq.19.and. &
299 ipdstmpl(2).eq.20) kpds(5) = 169
300 If (ipdstmpl(16).eq.2.and.ipdstmpl(1).eq.19.and. &
301 ipdstmpl(2).eq.21) kpds(5) = 171
302 If (ipdstmpl(16).eq.2.and.ipdstmpl(1).eq.19.and. &
303 ipdstmpl(2).eq.22) kpds(5) = 173
307 If (idisc.eq.0.and.ipdstmpl(1).eq.2)
then
308 if (ipdstmpl(2).eq.220)
then
312 if (ipdstmpl(2).eq.221)
then
316 if (ipdstmpl(2).eq.222)
then
320 if (ipdstmpl(2).eq.223)
then
326 If (idisc.eq.0.and.ipdstmpl(2).eq.16 &
327 .and.ipdstmpl(3).eq.198)
then
332 If (idisc.eq.0.and.ipdstmpl(2).eq.7 &
333 .and.ipdstmpl(3).eq.199)
then
341 If (ipdstmpl(1).eq.3.and.ipdstmpl(2).eq.3)
then
342 If (ipdstmpl(10).eq.11)
then
346 If (ipdstmpl(10).eq.12)
then
352 call levelcnv(ipdstmpl,kpds(6),kpds(7))
353 kpds(8)=mod(idsect(6),100)
354 if ( kpds(8).eq.0 ) kpds(8)=100
359 if ( ipdstmpl(8).ne.13 )
then
365 if ( ipdsnum.le.7 )
then
369 if ( kpds(14).eq.0 ) kpds(16)=1
370 if ( kpds(14).gt.255 ) kpds(16)=10
371 if ( ipdstmpl(5).eq.77.OR.ipdstmpl(5).eq.81.OR. &
372 ipdstmpl(5).eq.96.OR.ipdstmpl(5).eq.80.OR. &
373 ipdstmpl(5).eq.82.OR.ipdstmpl(5).eq.120.OR. &
374 ipdstmpl(5).eq.47.OR.ipdstmpl(5).eq.11 )
then
377 if (ipdstmpl(5).eq.84.AND.kpds(5).eq.154)kpds(16) = 10
382 if ( ipdstmpl(5).eq.88.OR.ipdstmpl(5).eq.121 &
383 .OR.ipdstmpl(5).eq.122.OR.ipdstmpl(5).eq.123 &
384 .OR.ipdstmpl(5).eq.124.OR.ipdstmpl(5).eq.125 &
385 .OR.ipdstmpl(5).eq.131.OR.ipdstmpl(5).eq.45 &
386 .OR.ipdstmpl(5).eq.11 )
then
391 if (kpds(5).eq.80.OR.kpds(5).eq.82.OR. &
392 kpds(5).eq.88.OR.kpds(5).eq.49.OR. &
393 kpds(5).eq.50) kpds(7)=1
394 if (ipdstmpl(5).eq.122.OR.ipdstmpl(5).eq.124.OR. &
395 ipdstmpl(5).eq.131.OR.ipdstmpl(5).eq.123.OR. &
396 ipdstmpl(5).eq.125.OR.ipdstmpl(5).eq.88.OR. &
397 ipdstmpl(5).eq.121) kpds(7)=1
398 if (idsect(1).eq.54.AND.ipdstmpl(5).eq.45) kpds(16) = 10
417 kpds(15)=ipdstmpl(ipos+3)+kpds(14)
418 selectcase (ipdstmpl(ipos))
434 kpds(20)=ipdstmpl(ipos-1)
436 if (ipdstmpl(9) .ge. 252)
then
437 if (ipdstmpl(ipos+3).eq.3)
then
439 kpds(14)=ipdstmpl(9)/3
440 kpds(15)=ipdstmpl(ipos+3)/3+kpds(14)
441 else if (ipdstmpl(ipos+3).eq.6)
then
443 kpds(14)=ipdstmpl(9)/6
444 kpds(15)=ipdstmpl(ipos+3)/6+kpds(14)
445 else if (ipdstmpl(ipos+3).eq.12)
then
447 kpds(14)=ipdstmpl(9)/12
448 kpds(15)=ipdstmpl(ipos+3)/12+kpds(14)
451 if (ipdsnum .eq. 8 .AND. ipdstmpl(9) .eq. 0)
then
452 if (ipdstmpl(ipos+3).ge.252)
then
454 kpds(14)=ipdstmpl(9)/3
455 kpds(15)=ipdstmpl(ipos+3)/3+kpds(14)
462 if (ipdstmpl(9) .ge. 240 )
then
463 if ( ipdstmpl(ipos+3).eq.15 .OR. ipdstmpl(ipos+3).eq.18 &
464 .OR. ipdstmpl(ipos+3).eq.21 .OR. &
465 ipdstmpl(ipos+3).eq.24 )
then
467 kpds(14)=ipdstmpl(9)/3
468 kpds(15)=ipdstmpl(ipos+3)/3+kpds(14)
474 if (ipdstmpl(4).eq.58 .AND. ipdsnum.eq.11 .AND. &
475 (ipdstmpl(1).eq.1 .AND.ipdstmpl(2).eq.8) &
476 .AND. (ipdstmpl(10).eq.1))
then
477 if (ipdstmpl(9) .ge. 252)
then
479 kpds(14)=ipdstmpl(9)/6
480 kpds(15)=ipdstmpl(ipos+3)/6+kpds(14)
489 if (ipdstmpl(4).eq.58 .AND. ipdsnum.eq.11 .AND. &
491 .AND.ipdstmpl(2).eq.0).AND.(ipdstmpl(10).eq.103))
then
494 If (ipdstmpl(27).eq.2 .AND. ipdstmpl(1).eq.0 .AND. &
495 ipdstmpl(2).eq.0) kpds(5) = 15
497 If (ipdstmpl(27).eq.3 .AND. ipdstmpl(1).eq.0 .AND. &
498 ipdstmpl(2).eq.0) kpds(5) = 16
503 if (ipdstmpl(5).eq.96.AND.((ipdstmpl(1).eq.19) &
504 .AND.(ipdstmpl(2).eq.20.or.ipdstmpl(2).eq.21.or. &
505 ipdstmpl(2).eq.22)).AND.(ipdstmpl(10).eq.100))
then
511 kpds(21)=(idsect(6)/100)+1
512 if ( kpds(8).eq.100 ) kpds(21)=idsect(6)/100
534 integer,
intent(in) :: ipdstmpl(*)
535 integer,
intent(out) :: ltype,lval
542 if ( ltype1.eq.10.AND.ltype2.eq.255 )
then
545 elseif ( ltype1.eq.11.AND.ltype2.eq.255 )
then
548 elseif ( ltype1.eq.12.AND.ltype2.eq.255 )
then
551 elseif ( ltype1.lt.100.AND.ltype2.eq.255 )
then
554 elseif ( ltype1.eq.1.AND.ltype2.eq.8 )
then
557 elseif ( ltype1.eq.10.AND.ltype2.eq.255 )
then
560 elseif ( ltype1.eq.235.AND.ltype2.eq.255 )
then
562 rscal1=10.**(-ipdstmpl(11))
563 lval=nint(real(ipdstmpl(12))*rscal1)
564 elseif ( ltype1.ge.200.AND.ltype2.eq.255 )
then
567 elseif (ltype1.eq.100.AND.ltype2.eq.255 )
then
569 rscal1=10.**(-ipdstmpl(11))
570 lval=nint(real(ipdstmpl(12))*rscal1/100.)
571 elseif (ltype1.eq.100.AND.ltype2.eq.100 )
then
573 rscal1=10.**(-ipdstmpl(11))
574 lval1=nint(real(ipdstmpl(12))*rscal1/1000.)
575 rscal2=10.**(-ipdstmpl(14))
576 lval2=nint(real(ipdstmpl(15))*rscal2/1000.)
577 lval=(lval1*256)+lval2
578 elseif (ltype1.eq.101.AND.ltype2.eq.255 )
then
581 elseif (ltype1.eq.102.AND.ltype2.eq.255 )
then
583 rscal1=10.**(-ipdstmpl(11))
584 lval=nint(real(ipdstmpl(12))*rscal1)
585 elseif (ltype1.eq.102.AND.ltype2.eq.102 )
then
587 rscal1=10.**(-ipdstmpl(11))
588 lval1=nint(real(ipdstmpl(12))*rscal1)
589 rscal2=10.**(-ipdstmpl(14))
590 lval2=nint(real(ipdstmpl(15))*rscal2)
591 lval=(lval1*256)+lval2
592 elseif (ltype1.eq.103.AND.ltype2.eq.255 )
then
594 rscal1=10.**(-ipdstmpl(11))
595 lval=nint(real(ipdstmpl(12))*rscal1)
596 elseif (ltype1.eq.103.AND.ltype2.eq.103 )
then
598 rscal1=10.**(-ipdstmpl(11))
599 lval1=nint(real(ipdstmpl(12))*rscal1/100.)
600 rscal2=10.**(-ipdstmpl(14))
601 lval2=nint(real(ipdstmpl(15))*rscal2/100.)
602 lval=(lval1*256)+lval2
603 elseif (ltype1.eq.104.AND.ltype2.eq.255 )
then
605 rscal1=10.**(-ipdstmpl(11))
606 lval=nint(real(ipdstmpl(12))*rscal1*10000.)
607 elseif (ltype1.eq.104.AND.ltype2.eq.104 )
then
609 rscal1=10.**(-ipdstmpl(11))
610 lval1=nint(real(ipdstmpl(12))*rscal1*100.)
611 rscal2=10.**(-ipdstmpl(14))
612 lval2=nint(real(ipdstmpl(15))*rscal2*100.)
613 lval=(lval1*256)+lval2
614 elseif (ltype1.eq.105.AND.ltype2.eq.255 )
then
617 elseif (ltype1.eq.105.AND.ltype2.eq.105 )
then
619 rscal1=10.**(-ipdstmpl(11))
620 lval1=nint(real(ipdstmpl(12))*rscal1)
621 rscal2=10.**(-ipdstmpl(14))
622 lval2=nint(real(ipdstmpl(15))*rscal2)
623 lval=(lval1*256)+lval2
624 elseif (ltype1.eq.106.AND.ltype2.eq.255 )
then
626 rscal1=10.**(-ipdstmpl(11))
627 lval=nint(real(ipdstmpl(12))*rscal1*100.)
628 elseif (ltype1.eq.106.AND.ltype2.eq.106 )
then
630 rscal1=10.**(-ipdstmpl(11))
631 lval1=nint(real(ipdstmpl(12))*rscal1*100.)
632 rscal2=10.**(-ipdstmpl(14))
633 lval2=nint(real(ipdstmpl(15))*rscal2*100.)
634 lval=(lval1*256)+lval2
635 elseif (ltype1.eq.107.AND.ltype2.eq.255 )
then
637 rscal1=10.**(-ipdstmpl(11))
638 lval=nint(real(ipdstmpl(12))*rscal1)
639 elseif (ltype1.eq.107.AND.ltype2.eq.107 )
then
641 rscal1=10.**(-ipdstmpl(11))
642 lval1=475-nint(real(ipdstmpl(12))*rscal1)
643 rscal2=10.**(-ipdstmpl(14))
644 lval2=475-nint(real(ipdstmpl(15))*rscal2)
645 lval=(lval1*256)+lval2
646 elseif (ltype1.eq.108.AND.ltype2.eq.255 )
then
648 rscal1=10.**(-ipdstmpl(11))
649 lval=nint(real(ipdstmpl(12))*rscal1/100.)
650 elseif (ltype1.eq.108.AND.ltype2.eq.108 )
then
652 rscal1=10.**(-ipdstmpl(11))
653 lval1=nint(real(ipdstmpl(12))*rscal1/100.)
654 rscal2=10.**(-ipdstmpl(14))
655 lval2=nint(real(ipdstmpl(15))*rscal2/100.)
656 lval=(lval1*256)+lval2
657 elseif (ltype1.eq.109.AND.ltype2.eq.255 )
then
659 rscal1=10.**(-ipdstmpl(11))
660 lval=nint(real(ipdstmpl(12))*rscal1*1000000000.)
661 elseif (ltype1.eq.111.AND.ltype2.eq.255 )
then
663 rscal1=10.**(-ipdstmpl(11))
664 lval=nint(real(ipdstmpl(12))*rscal1*10000.)
665 elseif (ltype1.eq.111.AND.ltype2.eq.111 )
then
667 rscal1=10.**(-ipdstmpl(11))
668 lval1=nint(real(ipdstmpl(12))*rscal1*100.)
669 rscal2=10.**(-ipdstmpl(14))
670 lval2=nint(real(ipdstmpl(15))*rscal2*100.)
671 lval=(lval1*256)+lval2
672 elseif (ltype1.eq.160.AND.ltype2.eq.255 )
then
674 rscal1=10.**(-ipdstmpl(11))
675 lval=nint(real(ipdstmpl(12))*rscal1)
676 elseif ((ltype1.ge.236.AND.ltype1.le.239).AND. &
677 (ltype2.ge.236.AND.ltype2.le.239))
then
679 rscal1=10.**(-ipdstmpl(11))
680 lval1=nint(real(ipdstmpl(12))*rscal1)
681 rscal2=10.**(-ipdstmpl(14))
682 lval2=nint(real(ipdstmpl(15))*rscal2)
683 lval=(lval1*256)+lval2
685 print *,
'levelcnv: GRIB2 Levels ',ltype1,ltype2, &
906subroutine gdt2gds(igds,igdstmpl,idefnum,ideflist,kgds, &
910 integer,
intent(in) :: idefnum
911 integer,
intent(in) :: igds(*),igdstmpl(*),ideflist(*)
912 integer,
intent(out) :: kgds(*),igrid,iret
914 integer :: kgds72(200),kgds71(200),idum(200),jdum(200)
917 if (igds(5).eq.0)
then
921 kgds(4)=igdstmpl(12)/1000
922 kgds(5)=igdstmpl(13)/1000
924 if (igdstmpl(1)==2) kgds(6)=64
925 if (btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5)) &
927 if (btest(igdstmpl(14),3)) kgds(6)=kgds(6)+8
928 kgds(7)=igdstmpl(15)/1000
929 kgds(8)=igdstmpl(16)/1000
930 kgds(9)=igdstmpl(17)/1000
931 kgds(10)=igdstmpl(18)/1000
932 kgds(11)=igdstmpl(19)
947 if (idefnum.ne.0)
then
948 if (igdstmpl(8).eq.-1)
then
952 if (igdstmpl(9).eq.-1)
then
958 if (kgds(1).eq.1.OR.kgds(1).eq.3) kgds(20)=43
961 kgds(21+j)=ideflist(j)
964 elseif (igds(5).eq.10)
then
968 kgds(4)=igdstmpl(10)/1000
969 kgds(5)=igdstmpl(11)/1000
971 if (igdstmpl(1)==2) kgds(6)=64
972 if (btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5)) &
974 if (btest(igdstmpl(12),3)) kgds(6)=kgds(6)+8
975 kgds(7)=igdstmpl(14)/1000
976 kgds(8)=igdstmpl(15)/1000
977 kgds(9)=igdstmpl(13)/1000
979 kgds(11)=igdstmpl(16)
980 kgds(12)=igdstmpl(18)/1000
981 kgds(13)=igdstmpl(19)/1000
991 elseif (igds(5).eq.30)
then
995 kgds(4)=igdstmpl(10)/1000
996 kgds(5)=igdstmpl(11)/1000
998 if (igdstmpl(1)==2) kgds(6)=64
999 if (btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5)) &
1001 if (btest(igdstmpl(12),3)) kgds(6)=kgds(6)+8
1002 kgds(7)=igdstmpl(14)/1000
1003 kgds(8)=igdstmpl(15)/1000
1004 kgds(9)=igdstmpl(16)/1000
1005 kgds(10)=igdstmpl(17)
1006 kgds(11)=igdstmpl(18)
1007 kgds(12)=igdstmpl(19)/1000
1008 kgds(13)=igdstmpl(20)/1000
1009 kgds(14)=igdstmpl(21)/1000
1010 kgds(15)=igdstmpl(22)/1000
1018 elseif (igds(5).eq.40)
then
1022 kgds(4)=igdstmpl(12)/1000
1023 kgds(5)=igdstmpl(13)/1000
1025 if (igdstmpl(1)==2) kgds(6)=64
1026 if (btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5)) &
1028 if (btest(igdstmpl(14),3)) kgds(6)=kgds(6)+8
1029 kgds(7)=igdstmpl(15)/1000
1030 kgds(8)=igdstmpl(16)/1000
1031 kgds(9)=igdstmpl(17)/1000
1032 kgds(10)=igdstmpl(18)
1033 kgds(11)=igdstmpl(19)
1045 elseif (igds(5).eq.20)
then
1049 kgds(4)=igdstmpl(10)/1000
1050 kgds(5)=igdstmpl(11)/1000
1052 if (igdstmpl(1)==2) kgds(6)=64
1053 if (btest(igdstmpl(12),4).OR.btest(igdstmpl(12),5)) &
1055 if (btest(igdstmpl(12),3)) kgds(6)=kgds(6)+8
1056 kgds(7)=igdstmpl(14)/1000
1057 kgds(8)=igdstmpl(15)/1000
1058 kgds(9)=igdstmpl(16)/1000
1059 kgds(10)=igdstmpl(17)
1060 kgds(11)=igdstmpl(18)
1072 elseif (igds(5).eq.204)
then
1079 if (igdstmpl(1)==2) kgds(6)=64
1080 if (btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5)) &
1082 if (btest(igdstmpl(14),3)) kgds(6)=kgds(6)+8
1087 kgds(11)=igdstmpl(19)
1102 if (idefnum.ne.0)
then
1103 if (igdstmpl(8).eq.-1)
then
1107 if (igdstmpl(9).eq.-1)
then
1113 if (kgds(1).eq.1.OR.kgds(1).eq.3) kgds(20)=43
1116 kgds(21+j)=ideflist(j)
1119 elseif (igds(5).eq.32768)
then
1123 kgds(4)=igdstmpl(12)/1000
1124 kgds(5)=igdstmpl(13)/1000
1126 if (igdstmpl(1)==2) kgds(6)=64
1127 if (btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5)) &
1129 if (btest(igdstmpl(14),3)) kgds(6)=kgds(6)+8
1130 kgds(7)=igdstmpl(15)/1000
1131 kgds(8)=igdstmpl(16)/1000
1132 kgds(9)=igdstmpl(17)/1000
1133 kgds(10)=igdstmpl(18)/1000
1134 kgds(11)=igdstmpl(19)
1149 if (idefnum.ne.0)
then
1150 if (igdstmpl(8).eq.-1)
then
1154 if (igdstmpl(9).eq.-1)
then
1160 if (kgds(1).eq.1.OR.kgds(1).eq.3) kgds(20)=43
1163 kgds(21+j)=ideflist(j)
1166 elseif (igds(5).eq.32769)
then
1170 kgds(4)=igdstmpl(12)/1000
1171 kgds(5)=igdstmpl(13)/1000
1173 if (igdstmpl(1)==2) kgds(6)=64
1174 if (btest(igdstmpl(14),4).OR.btest(igdstmpl(14),5)) &
1176 if (btest(igdstmpl(14),3)) kgds(6)=kgds(6)+8
1177 kgds(7)=igdstmpl(15)/1000
1178 kgds(8)=igdstmpl(16)/1000
1179 kgds(9)=igdstmpl(17)/1000
1180 kgds(10)=igdstmpl(18)/1000
1181 kgds(11)=igdstmpl(19)
1182 kgds(12)=igdstmpl(20)/1000
1183 kgds(13)=igdstmpl(21)/1000
1194 print *,
'gdt2gds: Unrecognized GRIB2 GDT = 3.',igds(5)
1207 call w3fi71(j,kgds71,ierr)
1208 if (ierr.ne.0) cycle
1210 if (kgds71(3).eq.0)
then
1211 if (kgds71(7).lt.0) kgds71(7)=360000+kgds71(7)
1212 if (kgds71(10).lt.0) kgds71(10)=360000+kgds71(10)
1213 elseif (kgds71(3).eq.1)
then
1214 if (kgds71(7).lt.0) kgds71(7)=360000+kgds71(7)
1215 if (kgds71(10).lt.0) kgds71(10)=360000+kgds71(10)
1216 elseif (kgds71(3).eq.3)
then
1217 if (kgds71(7).lt.0) kgds71(7)=360000+kgds71(7)
1218 if (kgds71(9).lt.0) kgds71(9)=360000+kgds71(9)
1219 if (kgds71(18).lt.0) kgds71(18)=360000+kgds71(18)
1220 elseif (kgds71(3).eq.4)
then
1221 if (kgds71(7).lt.0) kgds71(7)=360000+kgds71(7)
1222 if (kgds71(10).lt.0) kgds71(10)=360000+kgds71(10)
1223 elseif (kgds71(3).eq.5)
then
1224 if (kgds71(7).lt.0) kgds71(7)=360000+kgds71(7)
1225 if (kgds71(9).lt.0) kgds71(9)=360000+kgds71(9)
1227 call r63w72(idum,kgds,jdum,kgds72)
1228 if (kgds72(3).eq.3) kgds72(14)=0
1229 if (kgds72(3).eq.1) kgds72(15:18)=0
1230 if (kgds72(3).eq.5) kgds72(14:18)=0
1233 if (all(kgds71.eq.kgds72))
then
1382 KPROB,XPROB,KCLUST,KMEMBR,IBS,NBITS,LB,F,IRET)
1384 INTEGER KPDS(200),KGDS(200),KENS(200)
1385 INTEGER KPROB(2),KCLUST(16),KMEMBR(80)
1390 parameter(maxbit=24)
1391 INTEGER IBM(KF),IPDS(200),IGDS(200),IBDS(200)
1392 CHARACTER PDS(400),GRIB(1000+KF*(MAXBIT+1)/8)
1396 CALL r63w72(kpds,kgds,ipds,igds)
1401 IF(ipds(7).NE.0)
THEN
1411 IF(kbm.EQ.kf) ipds(7)=0
1426 CALL setbit(ipds(7),-ibs,ipds(25),kf,ibm,f,fmin,fmax,nbit)
1427 nbit=min(nbit,maxbit)
1432 CALL w3fi68(ipds,pds)
1433 IF(ipds(24).EQ.2)
THEN
1435 IF (ipds(8).EQ.191.OR.ipds(8).EQ.192) ilast=55
1436 IF (kens(2).EQ.5) ilast=76
1437 IF (kens(2).EQ.5) ilast=86
1438 IF (kens(2).EQ.4) ilast=86
1439 CALL pdsens(kens,kprob,xprob,kclust,kmembr,ilast,pds)
1445 if (igrid.ne.255) igflag=0
1453 CALL w3fi72(0,f,0,nbit,1,ipds,pds, &
1454 igflag,igrid,igds,icomp,0,ibm,kf,ibds, &
1455 kfo,grib,lgrib,iret)
1456 IF(iret.EQ.0)
CALL wryte(lugb,lgrib,grib)