NCEPLIBS-g2  3.5.0
g2sim.F90 File Reference

Pack/unpack a data field using simple packing algorithm. More...

Go to the source code of this file.

Functions/Subroutines

subroutine simpack (fld, ndpts, idrstmpl, cpack, lcpack)
 Pack a data field using a simple packing algorithm. More...
 
subroutine simunpack (cpack, len, idrstmpl, ndpts, fld)
 Unpack a data field that was packed using a simple packing, [Data Representation Template 5.0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml). More...
 

Detailed Description

Pack/unpack a data field using simple packing algorithm.

Author
Stephen Gilbert
Date
2000-06-21

Definition in file g2sim.F90.

Function/Subroutine Documentation

◆ simpack()

subroutine simpack ( real, dimension(ndpts), intent(in)  fld,
integer, intent(in)  ndpts,
integer, dimension(*), intent(inout)  idrstmpl,
character(len=1), dimension(*), intent(out)  cpack,
integer, intent(out)  lcpack 
)

Pack a data field using a simple packing algorithm.

This subroutine also fills in GRIB2 Data Representation Template 5.0 with the appropriate values.

Parameters
[in]fldContains the data values to pack.
[in]ndptsThe number of data values in array fld.
[in,out]idrstmplContains the array of values for Data Representation Template 5.2 or 5.3.
  • (1) Reference value - ignored on input
  • (2) Binary Scale Factor
  • (3) Decimal Scale Factor
  • (4) Number of bits used to pack data, if value is > 0 and <=
  1. If this input value is 0 or outside above range then the num of bits is calculated based on given data and scale factors.
  • (5) Original field type - currently ignored on input Data values assumed to be reals.
[out]cpackThe packed data field (character*1 array).
[out]lcpacklength of packed field cpack.
Author
Stephen Gilbert
Date
2000-06-21

Definition at line 26 of file g2sim.F90.

References g2_sbytec(), g2_sbytesc(), and mkieee().

Referenced by addfield(), and specpack().

◆ simunpack()

subroutine simunpack ( character(len=1), dimension(len), intent(in)  cpack,
integer, intent(in)  len,
integer, dimension(*), intent(in)  idrstmpl,
integer, intent(in)  ndpts,
real, dimension(ndpts), intent(out)  fld 
)

Unpack a data field that was packed using a simple packing, [Data Representation Template 5.0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml).

Parameters
[in]cpackThe packed data field (character*1 array).
[in]lenlength of packed field cpack.
[in]idrstmplContains the array of values for Data Representation Template 5.0.
[in]ndptsThe number of data values to unpack.
[out]fldContains the unpacked data values.
Author
Stephen Gilbert
Date
2000-06-21

Definition at line 168 of file g2sim.F90.

References g2_gbytesc(), and rdieee().

Referenced by getfield(), and gf_unpack7().