21 subroutine specpack(fld,ndpts,JJ,KK,MM,idrstmpl,cpack,lcpack)
23 real,
intent(in) :: fld(ndpts)
24 integer,
intent(in) :: ndpts,JJ,KK,MM
25 integer,
intent(inout) :: idrstmpl(*)
26 character(len=1),
intent(out) :: cpack(*)
27 integer,
intent(out) :: lcpack
29 integer :: Ts,tmplsim(5)
30 real :: bscale,dscale,unpk(ndpts),tfld(ndpts)
31 real,
allocatable :: pscale(:)
33 bscale = 2.0**real(-idrstmpl(2))
34 dscale = 10.0**real(idrstmpl(3))
42 allocate(pscale(jj+mm))
43 tscale=real(idrstmpl(5))*1e-6
45 pscale(n)=real(n*(n+1))**(tscale)
56 if (kk .eq. jj+mm) nm=jj+m
58 if (ks .eq. js+ms) ns=js+m
60 if (n.le.ns .AND. m.le.ms)
then
62 unpk(incu+1)=fld(inc+1)
67 tfld(incp)=fld(inc)*pscale(n)
68 tfld(incp+1)=fld(inc+1)*pscale(n)
78 if (incu .ne. ts)
then
79 print *,
'specpack: Incorrect number of unpacked values ',
'given:',ts
80 print *,
'specpack: Resetting idrstmpl(9) to ',incu
89 tmplsim(2)=idrstmpl(2)
90 tmplsim(3)=idrstmpl(3)
91 tmplsim(4)=idrstmpl(4)
92 call simpack(tfld,ndpts-ts,tmplsim,cpack(ipos+1),lcpack)
96 idrstmpl(1)=tmplsim(1)
97 idrstmpl(2)=tmplsim(2)
98 idrstmpl(3)=tmplsim(3)
99 idrstmpl(4)=tmplsim(4)
subroutine mkieee(a, rieee, num)
Copy an array of real to an array of 32-bit IEEE floating points.
subroutine simpack(fld, ndpts, idrstmpl, cpack, lcpack)
Pack up a data field using a simple packing algorithm as defined in the GRIB2 documention.
subroutine specpack(fld, ndpts, JJ, KK, MM, idrstmpl, cpack, lcpack)
This subroutine packs a spectral data field using the complex packing algorithm for spherical harmoni...