NCEPLIBS-g2  3.5.0
g2bytes.F90 File Reference

Extract or store arbitrary size values between packed bit string and integer or real scalars, or integer arrays. More...

Go to the source code of this file.

Functions/Subroutines

subroutine g2_gbytec (in, iout, iskip, nbits)
 Extract one arbitrary size big-endian value (up to 32 bits) from a packed bit string into one element of an integer array. More...
 
subroutine g2_gbytec1 (in, siout, iskip, nbits)
 Extract one arbitrary size big-endian integer value (up to 32 bits) from a packed bit string into a scalar integer. More...
 
subroutine g2_gbytec8 (in, iout, iskip, nbits)
 Extract one arbitrary sized (up to 64-bits) values from a packed bit string, right justifying each value in the unpacked array. More...
 
subroutine g2_gbytec81 (in, siout, iskip, nbits)
 Extract one arbitrary size big-endian integer value (up to 64 bits) from a packed bit string into a scalar integer. More...
 
subroutine g2_gbytesc (in, iout, iskip, nbits, nskip, n)
 Extract arbitrary size big-endian integer values (up to 32 bits each) from a packed bit string. More...
 
subroutine g2_gbytesc8 (in, iout, iskip, nbits, nskip, n)
 Extract arbitrary sized (up to 64-bits) values from a packed bit string, right justifying each value in the unpacked array. More...
 
subroutine g2_gbytescr (in, rout, iskip, nbits, nskip, n)
 Extract big-endian floating-point values (32 bits each) from a packed bit string. More...
 
subroutine g2_sbytec (out, in, iskip, nbits)
 Put one arbitrary sized (up to 32 bits) value from an integer array, into a packed bit string, in big-endian format. More...
 
subroutine g2_sbytec1 (out, in, iskip, nbits)
 Put one arbitrary sized (up to 32 bits) values from an integer scalar into a packed bit string, in big-endian format. More...
 
subroutine g2_sbytec8 (out, in, iskip, nbits)
 Put one arbitrary sized (up to 64 bits) values into a packed bit string, taking the low order bits from each value in the unpacked array. More...
 
subroutine g2_sbytec81 (out, sin, iskip, nbits)
 Put one arbitrary sized (up to 64 bits) scalar into a packed bit string, taking the low order bits from each value in the unpacked array. More...
 
subroutine g2_sbytesc (out, in, iskip, nbits, nskip, n)
 Put arbitrary size (up to 32 bits each) integer values into a packed bit string in big-endian order. More...
 
subroutine g2_sbytesc8 (out, in, iskip, nbits, nskip, n)
 Put arbitrary sized (up to 64 bits each) values into a packed bit string, taking the low order bits from each value in the unpacked array. More...
 
subroutine g2_sbytescr (out, rin, iskip, nbits, nskip, n)
 Put real values into a packed bit string in big-endian order. More...
 
subroutine mkieee (a, rieee, num)
 Copy an array of real to an array of 32-bit IEEE floating points. More...
 
subroutine rdieee (rieee, a, num)
 Copy array of 32-bit IEEE floating point values to local floating point representation. More...
 
subroutine rdieeec (cieee, a, num)
 Copy array of 32-bit IEEE floating point values stored in char array to local floating point representation. More...
 

Detailed Description

Extract or store arbitrary size values between packed bit string and integer or real scalars, or integer arrays.

Author
Stephen Gilbert
Date
2004-04-27

Definition in file g2bytes.F90.

Function/Subroutine Documentation

◆ g2_gbytec()

subroutine g2_gbytec ( character*1, dimension(*), intent(in)  in,
integer, dimension(*), intent(inout)  iout,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Extract one arbitrary size big-endian value (up to 32 bits) from a packed bit string into one element of an integer array.

This should be used converting one integer*4 value into an array element. If more values need to be converted, use g2_sbytesc(). To convert into a scalar integer, use g2_gbytec1().

Parameters
[in]inArray input.
[in,out]ioutUnpacked array output.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer in IN to take. Must be 32 or less.
Author
Stephen Gilbert
Date
2004-04-27

Definition at line 20 of file g2bytes.F90.

References g2_gbytesc().

Referenced by comunpack(), gb_info(), getfield(), getlocal(), gf_getfld(), gf_unpack1(), gf_unpack2(), gf_unpack3(), gf_unpack4(), gf_unpack5(), gf_unpack6(), gf_unpack7(), gribinfo(), and skgb8().

◆ g2_gbytec1()

subroutine g2_gbytec1 ( character*1, dimension(*), intent(in)  in,
integer, intent(inout)  siout,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Extract one arbitrary size big-endian integer value (up to 32 bits) from a packed bit string into a scalar integer.

This should be used converting one integer*4 value. If more values need to be converted, use g2_sbytesc().

Parameters
[in]inCharacter array input.
[in,out]sioutUnpacked scalar integer output.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer to take. Must be 32 or less.
Author
Edward Hartnett
Date
2024

Definition at line 51 of file g2bytes.F90.

References g2_gbytesc().

Referenced by addfield(), addgrid(), addlocal(), gb_info(), getfield(), getgb2l2(), getgb2r2(), getgb2rp2(), getgb2s2(), getlocal(), gettemplates(), gribend(), gribinfo(), ix2gb2(), unpack3(), unpack4(), unpack5(), and unpack6().

◆ g2_gbytec8()

subroutine g2_gbytec8 ( character*1, dimension(*), intent(in)  in,
integer (kind = 8), dimension(*), intent(inout)  iout,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Extract one arbitrary sized (up to 64-bits) values from a packed bit string, right justifying each value in the unpacked array.

This should be used when input array in has only one element. If in has more elements, use g2_sbytesc().

Parameters
[in]inArray input.
[in,out]ioutUnpacked array output.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer in IN to take. Must be 64 or less.
Author
Edward Hartnett
Date
2024

Definition at line 177 of file g2bytes.F90.

References g2_gbytesc8().

Referenced by getgb2rp2().

◆ g2_gbytec81()

subroutine g2_gbytec81 ( character*1, dimension(*), intent(in)  in,
integer (kind = 8), intent(inout)  siout,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Extract one arbitrary size big-endian integer value (up to 64 bits) from a packed bit string into a scalar integer.

This should be used converting one integer*4 value. If more values need to be converted, use g2_sbytesc().

Parameters
[in]inCharacter array input.
[in,out]sioutUnpacked scalar integer output.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer to take. Must be 32 or less.
Author
Edward Hartnett
Date
2024-05-11

Definition at line 208 of file g2bytes.F90.

References g2_gbytesc8().

Referenced by gb_info(), getfield(), getgb2l2(), getgb2r2(), getgb2rp2(), and gribinfo().

◆ g2_gbytesc()

subroutine g2_gbytesc ( character*1, dimension(*), intent(in)  in,
integer, dimension(*), intent(out)  iout,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Extract arbitrary size big-endian integer values (up to 32 bits each) from a packed bit string.

Parameters
[in]inarray input
[out]ioutunpacked array output
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each integer in IN to take. Must be 32 or less.
[in]nskipAdditional number of bits to skip on each iteration.
[in]nNumber of integers to extract.
Author
Stephen Gilbert
Date
2004-04-27

Definition at line 119 of file g2bytes.F90.

Referenced by comunpack(), g2_gbytec(), g2_gbytec1(), g2_gbytescr(), gf_unpack3(), gf_unpack6(), pngunpack(), simunpack(), specunpack(), unpack3(), and unpack6().

◆ g2_gbytesc8()

subroutine g2_gbytesc8 ( character*1, dimension(*), intent(in)  in,
integer (kind = 8), dimension(*), intent(out)  iout,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Extract arbitrary sized (up to 64-bits) values from a packed bit string, right justifying each value in the unpacked array.

Parameters
[in]inarray input
[out]ioutunpacked array output
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each integer in IN to take. Must be 64 or less.
[in]nskipAdditional number of bits to skip on each iteration.
[in]nNumber of integers to extract.
Author
Edward Hartnett, Stephen Gilbert
Date
2024

Definition at line 240 of file g2bytes.F90.

Referenced by g2_gbytec8(), and g2_gbytec81().

◆ g2_gbytescr()

subroutine g2_gbytescr ( character*1, dimension(*), intent(in)  in,
real (kind = 4), dimension(*), intent(out)  rout,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Extract big-endian floating-point values (32 bits each) from a packed bit string.

Parameters
[in]inarray input
[out]routunpacked array output
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each real in IN to take. Must be 32.
[in]nskipAdditional number of bits to skip on each
[in]nNumber of floats to extract.
Author
Edward Hartnett
Date
2024

Definition at line 85 of file g2bytes.F90.

References g2_gbytesc().

Referenced by gf_unpack4(), and unpack4().

◆ g2_sbytec()

subroutine g2_sbytec ( character*1, dimension(*), intent(inout)  out,
integer, dimension(*), intent(in)  in,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Put one arbitrary sized (up to 32 bits) value from an integer array, into a packed bit string, in big-endian format.

This should be used when input is an array and one value is to be packed. If more values are to be packed, use g2_sbytesc(). If packing a scalar integer, use g2_sytec1().

Parameters
[in,out]outpacked array output
[in]inunpacked array input
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each integer in OUT to fill.
Author
Stephen Gilbert
Date
2004-04-27

Definition at line 305 of file g2bytes.F90.

References g2_sbytesc().

Referenced by addfield(), addgrid(), compack(), gribcreate(), misspack(), and simpack().

◆ g2_sbytec1()

subroutine g2_sbytec1 ( character*1, dimension(*), intent(inout)  out,
integer, intent(in)  in,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Put one arbitrary sized (up to 32 bits) values from an integer scalar into a packed bit string, in big-endian format.

This should be used when input array in is a scalar. If an array element is to be packed, use g1_sbytec(). If more than one integer is to be packed, use g2_sbytesc().

Parameters
[in,out]outpacked characeter array output.
[in]inunpacked scalar integer input.
[in]iskipinitial number of bits to skip.
[in]nbitsNumber of bits of each integer in OUT to fill.
Author
Edward Hartnett
Date
2024

Definition at line 336 of file g2bytes.F90.

References g2_sbytesc().

Referenced by addfield(), addgrid(), addlocal(), gribcreate(), gribend(), and ix2gb2().

◆ g2_sbytec8()

subroutine g2_sbytec8 ( character*1, dimension(*), intent(inout)  out,
integer (kind = 8), dimension(*), intent(in)  in,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Put one arbitrary sized (up to 64 bits) values into a packed bit string, taking the low order bits from each value in the unpacked array.

This should be used when input array IN has only one element. If IN has more elements, use g2_sbytesc8().

Parameters
[in,out]outpacked array output
[in]inunpacked array input
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each integer in OUT to fill. Must be 64 or less.
Author
Edward Hartnett
Date
2024

Definition at line 472 of file g2bytes.F90.

References g2_sbytesc8().

◆ g2_sbytec81()

subroutine g2_sbytec81 ( character*1, dimension(*), intent(inout)  out,
integer (kind = 8), intent(in)  sin,
integer, intent(in)  iskip,
integer, intent(in)  nbits 
)

Put one arbitrary sized (up to 64 bits) scalar into a packed bit string, taking the low order bits from each value in the unpacked array.

This should be used when input is a scalar. If the input is an array, use sbytec8() or g2_sbytesc8().

Parameters
[in,out]outpacked array output
[in]sinunpacked scalar input
[in]iskipinitial number of bits to skip
[in]nbitsNumber of bits of each integer in OUT to fill. Must be 64 or less.
Author
Edward Hartnett
Date
2024

Definition at line 504 of file g2bytes.F90.

References g2_sbytesc8().

Referenced by getgb2rp2(), and ix2gb2().

◆ g2_sbytesc()

subroutine g2_sbytesc ( character*1, dimension(*), intent(out)  out,
integer, dimension(n), intent(in)  in,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Put arbitrary size (up to 32 bits each) integer values into a packed bit string in big-endian order.

Parameters
[out]outPacked character array output.
[in]inInteger array input.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer in OUT to fill. Must be 32 or less.
[in]nskipAdditional number of bits to skip on each iteration.
[in]nNumber of iterations.
Author
Stephen Gilbert
Date
2004-04-27

Definition at line 401 of file g2bytes.F90.

Referenced by addfield(), addgrid(), compack(), g2_sbytec(), g2_sbytec1(), g2_sbytescr(), jpcpack(), misspack(), pngpack(), and simpack().

◆ g2_sbytesc8()

subroutine g2_sbytesc8 ( character*1, dimension(*), intent(out)  out,
integer (kind = 8), dimension(n), intent(in)  in,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Put arbitrary sized (up to 64 bits each) values into a packed bit string, taking the low order bits from each value in the unpacked array.

Parameters
[out]outPacked array output.
[in]inUnpacked array input.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer in OUT to fill. Must be 64 or less.
[in]nskipAdditional number of bits to skip on each iteration.
[in]nNumber of iterations.
Author
Edward Hartnett, Stephen Gilbert
Date
2024

Definition at line 538 of file g2bytes.F90.

Referenced by g2_sbytec8(), and g2_sbytec81().

◆ g2_sbytescr()

subroutine g2_sbytescr ( character*1, dimension(*), intent(out)  out,
real, dimension(n), intent(in)  rin,
integer, intent(in)  iskip,
integer, intent(in)  nbits,
integer, intent(in)  nskip,
integer, intent(in)  n 
)

Put real values into a packed bit string in big-endian order.

Parameters
[out]outPacked character array output.
[in]rinreal array input.
[in]iskipInitial number of bits to skip.
[in]nbitsNumber of bits of each integer in OUT to fill. Must be 32.
[in]nskipAdditional number of bits to skip on each iteration.
[in]nNumber of iterations.
Author
Edward Hartnett
Date
2024

Definition at line 367 of file g2bytes.F90.

References g2_sbytesc().

Referenced by addfield().

◆ mkieee()

subroutine mkieee ( real(4), dimension(num), intent(in)  a,
real(4), dimension(num), intent(out)  rieee,
integer, intent(in)  num 
)

Copy an array of real to an array of 32-bit IEEE floating points.

Parameters
[in]aInput array of floating point values.
[out]rieeeOutput array of floating point values in 32-bit IEEE format. Note that this array is always 32-bit floats, even when compiled with -d.
[in]numNumber of floating point values to convert.
Author
Stephen Gilbert
Date
2000-05-09

Definition at line 684 of file g2bytes.F90.

Referenced by addfield(), compack(), jpcpack(), misspack(), pngpack(), simpack(), and specpack().

◆ rdieee()

subroutine rdieee ( real(4), dimension(num), intent(in)  rieee,
real, dimension(num), intent(out)  a,
integer, intent(in)  num 
)

Copy array of 32-bit IEEE floating point values to local floating point representation.

Parameters
[in]rieeeInput array of floating point values in 32-bit IEEE format. Note that this array is always 32-bit floats, even when compiled with -d.
[out]aOutput array of real values.
[in]numNumber of floating point values to convert.
Author
Stephen Gilbert
Date
2000-05-09

Definition at line 636 of file g2bytes.F90.

Referenced by comunpack(), getfield(), gf_unpack4(), gf_unpack7(), jpcunpack(), misspack(), pngunpack(), rdieeec(), simunpack(), specunpack(), and unpack4().

◆ rdieeec()

subroutine rdieeec ( character(len = 1), dimension(*), intent(in)  cieee,
real, dimension(num), intent(out)  a,
integer, intent(in)  num 
)

Copy array of 32-bit IEEE floating point values stored in char array to local floating point representation.

Parameters
[in]cieeeInput char array containing floating point values in 32-bit IEEE format.
[out]aOutput array of real values.
[in]numNumber of floating point values to convert.
Author
Edward Hartnett
Date
Mar 12, 2024

Definition at line 606 of file g2bytes.F90.

References rdieee().

Referenced by specunpack().