NCEPLIBS-w3emc 2.12.0
Loading...
Searching...
No Matches
w3fi63.f File Reference

Unpack GRIB field to a GRIB grid. More...

Go to the source code of this file.

Functions/Subroutines

subroutine fi631 (msga, kptr, kpds, kret)
 Find 'grib' chars & reset pointers.
 
subroutine fi632 (msga, kptr, kpds, kret)
 Gather info from product definition sec.
 
subroutine fi633 (msga, kptr, kgds, kret)
 Extract info from grib-gds.
 
subroutine fi634 (msga, kptr, kpds, kgds, kbms, kret)
 Extract or generate bit map for output.
 
subroutine fi634x (npts, nskp, msga, kbms)
 Extract bit map.
 
subroutine fi635 (msga, kptr, kpds, kgds, kbms, data, kret)
 Extract grib data elements from bds.
 
subroutine fi636 (data, msga, kbms, refnce, kptr, kpds, kgds)
 Process second order packing.
 
subroutine fi637 (j, kpds, kgds, kret)
 Grib grid/size test.
 
subroutine w3fi63 (msga, kpds, kgds, kbms, data, kptr, kret)
 Unpack a GRIB (edition 1) field to the exact grid specified in the GRIB message, isolate the bit map, and make the values of the product descripton section (PDS) and the grid description section (GDS) available in return arrays.
 

Detailed Description

Unpack GRIB field to a GRIB grid.

Author
Bill Cavanaugh
Date
1991-09-13

Definition in file w3fi63.f.

Function/Subroutine Documentation

◆ fi631()

subroutine fi631 ( character*1, dimension(*)  msga,
integer, dimension(*)  kptr,
integer, dimension(*)  kpds,
integer  kret 
)

Find 'grib' chars & reset pointers.

Author
Bill Cavanaugh
Date
1991-09-13 Find 'grib; characters and set pointers to the next byte following 'grib'. If they exist extract counts from gds and bms. Extract count from bds. Determine if sum of counts actually places terminator '7777' at the correct location.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • Mark Iredell 1995-10-31 Removed saves and prints.
Parameters
[in]MSGAGrib field - "grib" thru "7777"
[in,out]KPTRArray containing storage for following parameters
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags
  • 15 Nr unused bits at end of section 4
[out]KPDSArray containing pds elements.
  • 1 Id of center
  • 2 Model identification
  • 3 Grid identification
  • 4 Gds/bms flag
  • 5 Indicator of parameter
  • 6 Type of level
  • 7 Height/pressure , etc of level
  • 8 Year of century
  • 9 Month of year
  • 10 Day of month
  • 11 Hour of day
  • 12 Minute of hour
  • 13 Indicator of forecast time unit
  • 14 Time range 1
  • 15 Time range 2
  • 16 Time range flag
  • 17 Number included in average
[out]KRETError return
Note
ERROR RETURNS KRET:
  • 1 NO 'GRIB'
  • 2 NO '7777' OR MISLOCATED (BY COUNTS)
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 477 of file w3fi63.f.

◆ fi632()

subroutine fi632 ( character*1, dimension(*)  msga,
integer, dimension(*)  kptr,
integer, dimension(*)  kpds,
integer  kret 
)

Gather info from product definition sec.

Author
Bill Cavanaugh
Date
1991-09-13 Extract information from the product description sec , and generate label information to permit storage in office note 84 format.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • Bill Cavanaugh 1993-12-08 Corrected test for edition number instead of version number.
  • Mark Iredell 1995-10-31 Removed saves and prints.
  • M. Baldwin 1999-01-20 Modified to handle grid 237.
Parameters
[in]MSGAArray containing grib message.
[in,out]KPTRArray containing storage for following parameters.
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags
  • 15 Nr unused bits at end of section 4
[out]KPDSArray containing pds elements.
  • 1 Id of center
  • 2 Model identification
  • 3 Grid identification
  • 4 Gds/bms flag
  • 5 Indicator of parameter
  • 6 Type of level
  • 7 Height/pressure , etc of level
  • 8 Year of century
  • 9 Month of year
  • 10 Day of month
  • 11 Hour of day
  • 12 Minute of hour
  • 13 Indicator of forecast time unit
  • 14 Time range 1
  • 15 Time range 2
  • 16 Time range flag
  • 17 Number included in average
  • 18
  • 19
  • 20 Number missing from avgs/accumulations
  • 21 Century
  • 22 Units decimal scale factor
  • 23 Subcenter
[out]KRETError return.
Note
ERROR RETURN:
  • 0 - NO ERRORS
  • 8 - TEMP GDS INDICATED, BUT NO GDS
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 634 of file w3fi63.f.

◆ fi633()

subroutine fi633 ( character*1, dimension(*)  msga,
integer, dimension(*)  kptr,
integer, dimension(*)  kgds,
integer  kret 
)

Extract info from grib-gds.

Author
Bill Cavanaugh
Date
1991-09-13 Extract information on unlisted grid to allow conversion to office note 84 format.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • M. Baldwin 1995-03-20 fi633 modification to get data rep types [kgds(1)] 201 and 202 to work.
  • Mark Iredell 1995-10-31 Removed saves and prints
  • M. Baldwin 1998-09-08 Add data rep type [kgds(1)] 203
  • Boi Vuong 2007-04-24 Add data rep type [kgds(1)] 204
  • George Gayno 2010-07-20 Add data rep type [kgds(1)] 205
Parameters
[in]MSGAArray containing grib message
[in,out]KPTRArray containing storage for following parameters
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags
  • 15 Nr unused bits at end of section 4
[out]KGDSArray containing gds elements.
  • 1) Data representation type
  • 19 Number of vertical coordinate parameters
  • 20 Octet number of the list of vertical coordinate parameters Or Octet number of the list of numbers of points in each row Or 255 if neither are present.
  • 21 For grids with pl, number of points in grid
  • 22 Number of words in each row
  • Longitude grids
    • 2) N(i) nr points on latitude circle
    • 3) N(j) nr points on longitude meridian
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Resolution flag
    • 7) La(2) latitude of extreme point
    • 8) Lo(2) longitude of extreme point
    • 9) Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Polar stereographic grids
    • 2) N(i) nr points along lat circle
    • 3) N(j) nr points along lon circle
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Reserved
    • 7) Lov grid orientation
    • 8) Dx - x direction increment
    • 9) Dy - y direction increment
    • 10 Projection center flag
    • 11 Scanning mode
  • Spherical harmonic coefficients
    • 2 J pentagonal resolution parameter
    • 3 K pentagonal resolution parameter
    • 4 M pentagonal resolution parameter
    • 5 Representation type
    • 6 Coefficient storage mode
  • Mercator grids
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of last grid point
    • 8 Lo(2) longitude of last grid point
    • 9 Latin - latitude of projection intersection
    • 10 Reserved
    • 11 Scanning mode flag
    • 12 Longitudinal dir grid length
    • 13 Latitudinal dir grid length
  • Lambert conformal grids
    • 2 Nx nr points along x-axis
    • 3 Ny nr points along y-axis
    • 4 La1 lat of origin (lower left)
    • 5 Lo1 lon of origin (lower left)
    • 6 Resolution (right adj copy of octet 17)
    • 7 Lov - orientation of grid
    • 8 Dx - x-dir increment
    • 9 Dy - y-dir increment
    • 10 Projection center flag
    • 11 Scanning mode flag
    • 12 Latin 1 - first lat from pole of secant cone inter
    • 13 Latin 2 - second lat from pole of secant cone inter
  • Staggered arakawa rotated lat/lon grids (203 e stagger)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Staggered arakawa rotated lat/lon grids (205 a,b,c,d staggers)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
    • 12 Latitude of last point
    • 13 Longitude of last point
      Parameters
      [out]KRETError return
      Note
  • KRET
    • 0
    • 4 - Data representation type not currently acceptable
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 980 of file w3fi63.f.

◆ fi634()

subroutine fi634 ( character*1, dimension(*)  msga,
integer, dimension(*)  kptr,
integer, dimension(*)  kpds,
integer, dimension(*)  kgds,
logical*1, dimension(*)  kbms,
integer  kret 
)

Extract or generate bit map for output.

Author
Bill Cavanaugh
Date
1991-09-13 If bit map sec is available in grib message, extract for program use, otherwise generate an appropriate bit map.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • Bill Cavanaugh 1991-11-12 Modified size of ecmwf grids 5 - 8.
  • Mark Iredell 1995-10-31 removed saves and prints
  • W. Bostelman 1997-02-12 corrects ecmwf us grid 2 processing
  • Mark Iredell 1997-09-19 vectorized bitmap decoder
  • Stephen Gilbert 1998-09-02 corrected error in map size for u.s. grid 92
  • M. Baldwin 1998-09-08 add grids 190,192
  • M. Baldwin 1999-01-20 add grids 236,237
  • Eric Rogers 2001-10-02 redefined grid #218 for 12 km eta redefined grid 192 for new 32-km eta grid
  • Stephen Gilbert 2003-06-30 added grids 145 and 146 for cmaq and grid 175 for awips over guam.
  • Boi Vuong 2004-09-02 Added awips grids 147, 148, 173 and 254
  • Boi Vuong 2006-12-12 Added awips grids 120
  • Boi Vuong 2007-04-20 Added awips grids 176
  • Boi Vuong 2007-06-11 Added awips grids 11 to 18 and 122 to 125 and 180 to 183
  • Boi Vuong 2010-08-05 Added new grid 184, 199, 83 and redefined grid 90 for new rtma conus 1.27-km redefined grid 91 for new rtma alaska 2.976-km redefined grid 92 for new rtma alaska 1.488-km
  • Boi Vuong 2012-02-28 Added new grid 200
Parameters
[in]MSGABufr message
[in,out]KPTRArray containing storage for following parameters
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags
  • 15 Nr unused bits at end of section 4
[in]KPDSArray containing pds elements.
  • 1 Id of center
  • 2 Model identification
  • 3 Grid identification
  • 4 Gds/bms flag
  • 5 Indicator of parameter
  • 6 Type of level
  • 7 Height/pressure , etc of level
  • 8 Year of century
  • 9 Month of year
  • 10 Day of month
  • 11 Hour of day
  • 12 Minute of hour
  • 13 Indicator of forecast time unit
  • 14 Time range 1
  • 15 Time range 2
  • 16 Time range flag
  • 17 Number included in average
[in]KGDSArray containing gds elements.
  • 1) Data representation type
  • 19 Number of vertical coordinate parameters
  • 20 Octet number of the list of vertical coordinate parameters Or Octet number of the list of numbers of points in each row Or 255 if neither are present.
  • 21 For grids with pl, number of points in grid
  • 22 Number of words in each row
  • Longitude grids
    • 2) N(i) nr points on latitude circle
    • 3) N(j) nr points on longitude meridian
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Resolution flag
    • 7) La(2) latitude of extreme point
    • 8) Lo(2) longitude of extreme point
    • 9) Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Polar stereographic grids
    • 2) N(i) nr points along lat circle
    • 3) N(j) nr points along lon circle
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Reserved
    • 7) Lov grid orientation
    • 8) Dx - x direction increment
    • 9) Dy - y direction increment
    • 10 Projection center flag
    • 11 Scanning mode
  • Spherical harmonic coefficients
    • 2 J pentagonal resolution parameter
    • 3 K pentagonal resolution parameter
    • 4 M pentagonal resolution parameter
    • 5 Representation type
    • 6 Coefficient storage mode
  • Mercator grids
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of last grid point
    • 8 Lo(2) longitude of last grid point
    • 9 Latin - latitude of projection intersection
    • 10 Reserved
    • 11 Scanning mode flag
    • 12 Longitudinal dir grid length
    • 13 Latitudinal dir grid length
  • Lambert conformal grids
    • 2 Nx nr points along x-axis
    • 3 Ny nr points along y-axis
    • 4 La1 lat of origin (lower left)
    • 5 Lo1 lon of origin (lower left)
    • 6 Resolution (right adj copy of octet 17)
    • 7 Lov - orientation of grid
    • 8 Dx - x-dir increment
    • 9 Dy - y-dir increment
    • 10 Projection center flag
    • 11 Scanning mode flag
    • 12 Latin 1 - first lat from pole of secant cone inter
    • 13 Latin 2 - second lat from pole of secant cone inter
  • Staggered arakawa rotated lat/lon grids (203 e stagger)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Staggered arakawa rotated lat/lon grids (205 a,b,c,d staggers)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
    • 12 Latitude of last point
    • 13 Longitude of last point
      Parameters
      [out]KBMSBitmap describing location of output elements.
      [out]KRETError return
      Note
  • KRET
    • 0 - No error
    • 5 - Grid not avail for center indicated
    • 10 - Incorrect center indicator
    • 12 - Bytes 5-6 are not zero in bms, predefined bit map not provided by this center
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 1526 of file w3fi63.f.

◆ fi634x()

subroutine fi634x (   npts,
  nskp,
character*1, dimension(*)  msga,
logical*1, dimension(npts)  kbms 
)

Extract bit map.

Author
Mark Iredell
Date
1997-09-19 Extract the packed bitmap into a logical array.

Program history log: 97-09-19 Vectorized bitmap decoder.

Parameters
[in]NPTSXInteger number of points in the bitmap field
[in]NSKPInteger number of bits to skip in grib message
[in]MSGACharacter*1 grib message
[out]KBMSLogical*1 bitmap
Note
Subprogram can be called from a multiprocessing environment.
Author
Mark Iredell
Date
1997-09-19

Definition at line 2511 of file w3fi63.f.

◆ fi635()

subroutine fi635 ( character*1, dimension(*)  msga,
integer, dimension(*)  kptr,
integer, dimension(*)  kpds,
integer, dimension(*)  kgds,
logical*1, dimension(*)  kbms,
real, dimension(*)  data,
  kret 
)

Extract grib data elements from bds.

Author
Bill Cavanaugh
Date
1991-09-13 Extract grib data from binary data section and place into output array in proper position.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • Bill Cavanaugh 1994-04-01 Modified code to include decimal scaling when calculating the value of data points specified as being equal to the reference value
  • Farley 1994-11-10 Increased mxsize from 72960 to 260000 for .5 degree sst analysis fields.
  • Mark Iredell 1995-10-31 Removed saves and prints
  • Mark Iredell 1998-08-31 Eliminated need for mxsize
Parameters
[in]MSGAArray containing grib message
[in,out]KPTRArray containing storage for following parameters
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags
  • 15 Nr unused bits at end of section 4
  • 16 Reserved
  • 17 Reserved
  • 18 Reserved
  • 19 Binary scale factor
  • 20 Num bits used to pack each datum
[in]KPDSArray containing pds elements. See initial routine
[in]KGDSArray containing gds elements.
  • 1) Data representation type
  • 19 Number of vertical coordinate parameters
  • 20 Octet number of the list of vertical coordinate parameters Or Octet number of the list of numbers of points in each row Or 255 if neither are present.
  • 21 For grids with pl, number of points in grid
  • 22 Number of words in each row
  • Longitude grids
    • 2) N(i) nr points on latitude circle
    • 3) N(j) nr points on longitude meridian
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Resolution flag
    • 7) La(2) latitude of extreme point
    • 8) Lo(2) longitude of extreme point
    • 9) Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Polar stereographic grids
    • 2) N(i) nr points along lat circle
    • 3) N(j) nr points along lon circle
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Reserved
    • 7) Lov grid orientation
    • 8) Dx - x direction increment
    • 9) Dy - y direction increment
    • 10 Projection center flag
    • 11 Scanning mode
  • Spherical harmonic coefficients
    • 2 J pentagonal resolution parameter
    • 3 K pentagonal resolution parameter
    • 4 M pentagonal resolution parameter
    • 5 Representation type
    • 6 Coefficient storage mode
  • Mercator grids
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of last grid point
    • 8 Lo(2) longitude of last grid point
    • 9 Latin - latitude of projection intersection
    • 10 Reserved
    • 11 Scanning mode flag
    • 12 Longitudinal dir grid length
    • 13 Latitudinal dir grid length
  • Lambert conformal grids
    • 2 Nx nr points along x-axis
    • 3 Ny nr points along y-axis
    • 4 La1 lat of origin (lower left)
    • 5 Lo1 lon of origin (lower left)
    • 6 Resolution (right adj copy of octet 17)
    • 7 Lov - orientation of grid
    • 8 Dx - x-dir increment
    • 9 Dy - y-dir increment
    • 10 Projection center flag
    • 11 Scanning mode flag
    • 12 Latin 1 - first lat from pole of secant cone inter
    • 13 Latin 2 - second lat from pole of secant cone inter
  • Staggered arakawa rotated lat/lon grids (203 e stagger)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Staggered arakawa rotated lat/lon grids (205 a,b,c,d staggers)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
    • 12 Latitude of last point
    • 13 Longitude of last point
      Parameters
      [in]KBMSBitmap describing location of output elements. -KBDS Information extracted from binary data section
    • KBDS(1) - N1
    • KBDS(2) - N2
    • KBDS(3) - P1
    • KBDS(4) - P2
    • KBDS(5) - Bit pointer to 2nd order widths
    • KBDS(6) - Bit pointer to 2nd order bit maps
    • KBDS(7) - Bit pointer to first order values
    • KBDS(8) - Bit pointer to second order values
    • KBDS(9) - Bit pointer start of bds
    • KBDS(10) - Bit pointer main bit map
    • KBDS(11) - Binary scaling
    • KBDS(12) - Decimal scaling
    • KBDS(13) - Bit width of first order values
    • KBDS(14) - Bit map flag 0 = no second order bit map 1 = second order bit map present
  • KBDS(15) - Second order bit width
  • KBDS(16) - Constant / different widths 0 = constant widths 1 = different widths
  • KBDS(17) - Single datum / matrix
    • 0 = single datum at each grid point
    • 1 = matrix of values at each grid point
    • (18-20) - Unused
      Parameters
      [out]DATAReal*4 array of gridded elements in grib message.
      [out]KRETError return
      Note
  • Error return
    • 3 = Unpacked field is larger than 65160
    • 6 = Does not match nr of entries for this grib/grid
    • 7 = Number of bits in fill too large
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 2685 of file w3fi63.f.

◆ fi636()

subroutine fi636 ( real, dimension(*)  data,
character*1, dimension(*)  msga,
logical*1, dimension(*)  kbms,
real  refnce,
integer, dimension(*)  kptr,
integer, dimension(*)  kpds,
integer, dimension(*)  kgds 
)

Process second order packing.

Author
Bill Cavanaugh
Date
1992-09-22 Process second order packing from the binary data section (bds) for single data items grid point data.

Program history log:

  • Bill Cavanaugh 1993-06-08
  • Bill Cavanaugh 1993-12-15 Modified second order pointers to first order values and second order values correctly.
  • Ralph Jones 1995-04-26 Fi636 corection for 2nd order complex Unpacking.
  • Mark Iredell 1995-10-31 Saves and prints.
Parameters
[in]MSGAArray containing grib message
[in]REFNCEReference value
[in]KPTRWork array
[out]DATALocation of output array
  • KBDS Working array
    • KBDS(1) N1
    • KBDS(2) N2
    • KBDS(3) P1
    • KBDS(4) P2
    • KBDS(5) Bit pointer to 2nd order widths
    • KBDS(6) Bit pointer to 2nd order bit maps
    • KBDS(7) Bit pointer to first order values
    • KBDS(8) Bit pointer to second order values
    • KBDS(9) Bit pointer start of bds
    • KBDS(10) Bit pointer main bit map
    • KBDS(11) Binary scaling
    • KBDS(12) Decimal scaling
    • KBDS(13) Bit width of first order values
    • KBDS(14) Bit map flag
      • 0 = No second order bit map
      • 1 = Second order bit map present
    • KBDS(15) Second order bit width
    • KBDS(16) Constant / different widths
      • 0 = Constant widths
      • 1 = Different widths
    • KBDS(17) Single datum / matrix
      • 0 = Single datum at each grid point
      • 1 = Matrix of values at each grid point
    • KBDS(18-20) Unused
[in]KBMS
[in]KPDS
[in]KGDSArray containing gds elements.
  • 1) Data representation type
  • 19 Number of vertical coordinate parameters
  • 20 Octet number of the list of vertical coordinate parameters Or Octet number of the list of numbers of points in each row Or 255 if neither are present.
  • 21 For grids with pl, number of points in grid
  • 22 Number of words in each row
  • Longitude grids
    • 2) N(i) nr points on latitude circle
    • 3) N(j) nr points on longitude meridian
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Resolution flag
    • 7) La(2) latitude of extreme point
    • 8) Lo(2) longitude of extreme point
    • 9) Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Polar stereographic grids
    • 2) N(i) nr points along lat circle
    • 3) N(j) nr points along lon circle
    • 4) La(1) latitude of origin
    • 5) Lo(1) longitude of origin
    • 6) Reserved
    • 7) Lov grid orientation
    • 8) Dx - x direction increment
    • 9) Dy - y direction increment
    • 10 Projection center flag
    • 11 Scanning mode
  • Spherical harmonic coefficients
    • 2 J pentagonal resolution parameter
    • 3 K pentagonal resolution parameter
    • 4 M pentagonal resolution parameter
    • 5 Representation type
    • 6 Coefficient storage mode
  • Mercator grids
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of last grid point
    • 8 Lo(2) longitude of last grid point
    • 9 Latin - latitude of projection intersection
    • 10 Reserved
    • 11 Scanning mode flag
    • 12 Longitudinal dir grid length
    • 13 Latitudinal dir grid length
  • Lambert conformal grids
    • 2 Nx nr points along x-axis
    • 3 Ny nr points along y-axis
    • 4 La1 lat of origin (lower left)
    • 5 Lo1 lon of origin (lower left)
    • 6 Resolution (right adj copy of octet 17)
    • 7 Lov - orientation of grid
    • 8 Dx - x-dir increment
    • 9 Dy - y-dir increment
    • 10 Projection center flag
    • 11 Scanning mode flag
    • 12 Latin 1 - first lat from pole of secant cone inter
    • 13 Latin 2 - second lat from pole of secant cone inter
  • Staggered arakawa rotated lat/lon grids (203 e stagger)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
  • Staggered arakawa rotated lat/lon grids (205 a,b,c,d staggers)
    • 2 N(i) nr points on rotated latitude circle
    • 3 N(j) nr points on rotated longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag
    • 12 Latitude of last point
    • 13 Longitude of last point
Author
Bill Cavanaugh
Date
1992-09-22

Definition at line 3330 of file w3fi63.f.

◆ fi637()

subroutine fi637 ( integer  j,
integer, dimension(*)  kpds,
integer, dimension(*)  kgds,
  kret 
)

Grib grid/size test.

Author
Bill Cavanaugh
Date
1991-09-13 To test when gds is available to see if size mismatch on existing grids (by center) is indicated.

Program history log:

  • Bill Cavanaugh 1991-09-13
  • Mark Iredell 1995-10-31 Removed saves and prints
  • M. Bostelman 1997-02-12 Corrects ecmwf us grid 2 processing
  • Mark Iredell 1998-06-17 Removed alternate return
  • M. Baldwin 1999-01-20 Modify to handle grid 237
  • Boi Vuong 1909-05-21 Modify to handle grid 45
Parameters
[in,out]JSize for indicated grid modified for ecmwf-us 2
[in]KPDS
[in]KGDS
[out]KRETError return (a mismatch was detected if kret is not zero)
Note
  • KRET:
    • 9 - Gds indicates size mismatch with std grid
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 3597 of file w3fi63.f.

◆ w3fi63()

subroutine w3fi63 ( character*1, dimension(*)  msga,
integer, dimension(*)  kpds,
integer, dimension(*)  kgds,
logical*1, dimension(*)  kbms,
real, dimension(*)  data,
integer, dimension(*)  kptr,
  kret 
)

Unpack a GRIB (edition 1) field to the exact grid specified in the GRIB message, isolate the bit map, and make the values of the product descripton section (PDS) and the grid description section (GDS) available in return arrays.

When decoding is completed, data at each grid point has been returned in the units specified in the GRIB manual.

See "GRIB - THE WMO FORMAT FOR THE STORAGE OF WEATHER PRODUCT INFORMATION AND THE EXCHANGE OF WEATHER PRODUCT MESSAGES IN GRIDDED BINARY FORM" dated July 1, 1988 by John D. Stackpolem DOC, NOAA, NWS, National Meteorological Center.

List of text messages from code:

  • W3FI63/FI632
    • 'HAVE ENCOUNTERED A NEW GRID FOR NMC, PLEASE NOTIFY AUTOMATION DIVISION, PRODUCTION MANAGEMENT BRANCH (W/NMC42)'
    • 'HAVE ENCOUNTERED A NEW GRID FOR ECMWF, PLEASE NOTIFY AUTOMATION DIVISION, PRODUCTION MANAGEMENT BRANCH (W/NMC42)'
    • 'HAVE ENCOUNTERED A NEW GRID FOR U.K. METEOROLOGICAL OFFICE, BRACKNELL. PLEASE NOTIFY AUTOMATION DIVISION, PRODUCTION MANAGEMENT BRANCH (W/NMC42)'
    • 'HAVE ENCOUNTERED A NEW GRID FOR FNOC, PLEASE NOTIFY AUTOMATION DIVISION, PRODUCTION MANAGEMENT BRANCH (W/NMC42)'
  • W3FI63/FI633
    • 'POLAR STEREO PROCESSING NOT AVAILABLE'
  • W3FI63/FI634
    • 'WARNING - BIT MAP MAY NOT BE ASSOCIATED WITH SPHERICAL COEFFICIENTS'
  • W3FI63/FI637
    • 'NO CURRENT LISTING OF FNOC GRIDS'
Parameters
[in]MSGAGrib field - "grib" thru "7777" char*1 (message can be preceded by junk chars). Contains the grib message to be unpacked. characters "GRIB" may begin anywhere within first 100 bytes.
[out]KPDSArray of size 100 containing PDS elements, GRIB (edition 1):
  • 1 Id of center
  • 2 Generating process id number
  • 3 Grid definition
  • 4 Gds/bms flag (right adj copy of octet 8)
  • 5 Indicator of parameter
  • 6 Type of level
  • 7 Height/pressure , etc of level
  • 8 Year including (century-1)
  • 9 Month of year
  • 10 Day of month
  • 11 Hour of day
  • 12 Minute of hour
  • 13 Indicator of forecast time unit
  • 14 Time range 1
  • 15 Time range 2
  • 16 Time range flag
  • 17 Number included in average
  • 18 Version nr of grib specification
  • 19 Version nr of parameter table
  • 20 Nr missing from average/accumulation
  • 21 Century of reference time of data
  • 22 Units decimal scale factor
  • 23 Subcenter number
  • 24 Pds byte 29, for nmc ensemble products
    • 128 If forecast field error
    • 64 If bias corrected fcst field
    • 32 If smoothed field
    • Warning: can be combination of more than 1
  • 25 Pds byte 30, not used
  • 26-35 Reserved
  • 36-N Consecutive bytes extracted from program Definition section (pds) of grib message
[out]KGDSARRAY CONTAINING GDS ELEMENTS.
  • 1) Data representation type
  • 19 Number of vertical coordinate parameters
  • 20 Octet number of the list of vertical coordinate Parameters Or Octet number of the list of numbers of points In each row Or 255 if neither are present
  • 21 For grids with pl, number of points in grid
  • 22 Number of words in each row
  • LATITUDE/LONGITUDE GRIDS
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 La(2) latitude of extreme point
    • 8 Lo(2) longitude of extreme point
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag (right adj copy of octet 28)
  • GAUSSIAN GRIDS
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 La(2) latitude of extreme point
    • 8 Lo(2) longitude of extreme point
    • 9 Di longitudinal direction of increment
    • 10 N - nr of circles pole to equator
    • 11 Scanning mode flag (right adj copy of octet 28)
    • 12 Nv - nr of vert coord parameters
    • 13 Pv - octet nr of list of vert coord parameters or Pl - location of the list of numbers of points in each row (if no vert coord parameters are present or 255 if neither are present
  • POLAR STEREOGRAPHIC GRIDS
    • 2 N(i) nr points along lat circle
    • 3 N(j) nr points along lon circle
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 Lov grid orientation
    • 8 Dx - x direction increment
    • 9 Dy - y direction increment
    • 10 Projection center flag
    • 11 Scanning mode (right adj copy of octet 28)
  • SPHERICAL HARMONIC COEFFICIENTS
    • 2) J pentagonal resolution parameter
    • 3) K pentagonal resolution parameter
    • 4) M pentagonal resolution parameter
    • 5) Representation type
    • 6) Coefficient storage mode
  • MERCATOR GRIDS
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 La(2) latitude of last grid point
    • 8 Lo(2) longitude of last grid point
    • 9 Latit - latitude of projection intersection
    • 10 Reserved
    • 11 Scanning mode flag (right adj copy of octet 28)
    • 12 Longitudinal dir grid length
    • 13 Latitudinal dir grid length
  • LAMBERT CONFORMAL GRIDS
    • 2 Nx nr points along x-axis
    • 3 Ny nr points along y-axis
    • 4 La1 lat of origin (lower left)
    • 5 Lo1 lon of origin (lower left)
    • 6 Resolution (right adj copy of octet 17)
    • 7 Lov - orientation of grid
    • 8 Dx - x-dir increment
    • 9 Dy - y-dir increment
    • 10 Projection center flag
    • 11 Scanning mode flag (right adj copy of octet 28)
    • 12 Latin 1 - first lat from pole of secant cone inter
    • 13 Latin 2 - second lat from pole of secant cone inter
  • E-STAGGERED ARAKAWA ROTATED LAT/LON GRIDS (TYPE 203)
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of origin
    • 5 Lo(1) longitude of origin
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag (right adj copy of octet 28)
  • CURVILINEAR ORTHIGINAL GRID (TYPE 204)
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 Reserved set to 0
    • 5 Reserved set to 0
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 Reserved set to 0
    • 8 Reserved set to 0
    • 9 Reserved set to 0
    • 10 Reserved set to 0
    • 11 Scanning mode flag (right adj copy of octet 28)
  • ROTATED LAT/LON A,B,C,D-STAGGERED (TYPE 205)
    • 2 N(i) nr points on latitude circle
    • 3 N(j) nr points on longitude meridian
    • 4 La(1) latitude of first point
    • 5 Lo(1) longitude of first point
    • 6 Resolution flag (right adj copy of octet 17)
    • 7 La(2) latitude of center
    • 8 Lo(2) longitude of center
    • 9 Di longitudinal direction of increment
    • 10 Dj latitudinal direction increment
    • 11 Scanning mode flag (right adj copy of octet 28)
    • 12 Latitude of last point
    • 13 Longitude of last point
      Parameters
      [out]KBMSBitmap describing location of output elements. (always constructed)
      [out]DATAArray containing the unpacked data elements. Note: 65160 is maximun field size allowable.
      [out]KPTRArray containing storage for following parameters
  • 1 Total length of grib message
  • 2 Length of indicator (section 0)
  • 3 Length of pds (section 1)
  • 4 Length of gds (section 2)
  • 5 Length of bms (section 3)
  • 6 Length of bds (section 4)
  • 7 Value of current byte
  • 8 Bit pointer
  • 9 Grib start bit nr
  • 10 Grib/grid element count
  • 11 Nr unused bits at end of section 3
  • 12 Bit map flag (copy of bms octets 5,6)
  • 13 Nr unused bits at end of section 2
  • 14 Bds flags (right adj copy of octet 4)
  • 15 Nr unused bits at end of section 4
  • 16 Reserved
  • 17 Reserved
  • 18 Reserved
  • 19 Binary scale factor
  • 20 Num bits used to pack each datum
    Parameters
    [out]KRETFlag indicating quality of completion.
    Note
    When decoding is completed, data at each grid point has been returned in the units specified in the grib manual.
  • Values for return flag (kret)
    • 0 - Normal return, no errors
    • 1 - 'grib' not found in first 100 chars
    • 2 - '7777' not in correct location
    • 3 - Unpacked field is larger than 260000
    • 4 - Gds/ grid not one of currently accepted values
    • 5 - Grid not currently avail for center indicated
    • 8 - Temp gds indicated, but gds flag is off
    • 9 - Gds indicates size mismatch with std grid
    • 10 - Incorrect center indicator
    • 11 - Binary data section (bds) not completely processed. program is not set to process flag combinations shown in octets 4 and 14.
    • 12 - Binary data section (bds) not completely processed. program is not set to process flag combinations
Author
Bill Cavanaugh
Date
1991-09-13

Definition at line 242 of file w3fi63.f.