52 subroutine gf_unpack3(cgrib,lcgrib,iofst,igds,igdstmpl,
53 & mapgridlen,ideflist,idefnum,ierr)
58 character(len=1),
intent(in) :: cgrib(lcgrib)
59 integer,
intent(in) :: lcgrib
60 integer,
intent(inout) :: iofst
61 integer,
pointer,
dimension(:) :: igdstmpl,ideflist
62 integer,
intent(out) :: igds(5)
63 integer,
intent(out) :: ierr,idefnum
65 integer,
allocatable :: mapgrid(:)
66 integer :: mapgridlen,ibyttem
70 nullify(igdstmpl,ideflist)
87 if (igds(1).eq.0.OR.igds(1).eq.255)
then
88 allocate(mapgrid(lensec))
94 if(
allocated(mapgrid) )
deallocate(mapgrid)
108 if (mapgridlen.gt.0)
allocate(igdstmpl(mapgridlen),stat=istat)
112 if(
allocated(mapgrid) )
deallocate(mapgrid)
117 nbits=iabs(mapgrid(i))*8
118 if ( mapgrid(i).ge.0 )
then
119 call g2_gbytec(cgrib,igdstmpl(i),iofst,nbits)
122 call g2_gbytec(cgrib,igdstmpl(i),iofst+1,nbits-1)
123 if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
126 ibyttem=ibyttem+iabs(mapgrid(i))
138 call realloc(igdstmpl,mapgridlen,newmapgridlen,istat)
139 do i=mapgridlen+1,newmapgridlen
140 nbits=iabs(mapgrid(i))*8
141 if ( mapgrid(i).ge.0 )
then
142 call g2_gbytec(cgrib,igdstmpl(i),iofst,nbits)
145 call g2_gbytec(cgrib,igdstmpl(i),iofst+1,nbits-1)
146 if (isign.eq.1) igdstmpl(i)=-igdstmpl(i)
149 ibyttem=ibyttem+iabs(mapgrid(i))
151 mapgridlen=newmapgridlen
153 if(
allocated(mapgrid) )
deallocate(mapgrid)
159 if ( igds(3).ne.0 )
then
161 idefnum=(lensec-14-ibyttem)/igds(3)
163 if (idefnum.gt.0)
allocate(ideflist(idefnum),stat=istat)
169 call g2_gbytesc(cgrib,ideflist,iofst,nbits,0,idefnum)
170 iofst=iofst+(nbits*idefnum)