|
NCEPLIBS-g2
3.4.8
|
Contains subroutines obtain grid information and the unpacked data (section 3 - 6) for a field from a GRIB2 file. More...
Go to the source code of this file.
Functions/Subroutines | |
| subroutine | getfield (cgrib, lcgrib, ifldnum, igds, igdstmpl, igdslen, ideflist, idefnum, ipdsnum, ipdstmpl, ipdslen, coordlist, numcoord, ndpts, idrsnum, idrstmpl, idrslen, ibmap, bmap, fld, ierr) |
| This subroutine returns the Grid Definition, Product Definition, Bit-map (if applicable), and the unpacked data for a given data field. More... | |
| subroutine | unpack3 (cgrib, lcgrib, iofst, igds, igdstmpl, mapgridlen, ideflist, idefnum, ierr) |
| This subroutine unpacks Section 3 (Grid Definition Section) starting at octet 6 of that Section. More... | |
| subroutine | unpack4 (cgrib, lcgrib, iofst, ipdsnum, ipdstmpl, mappdslen, coordlist, numcoord, ierr) |
| This subroutine unpacks Section 4 (Product Definition Section) starting at octet 6 of that Section. More... | |
| subroutine | unpack5 (cgrib, lcgrib, iofst, ndpts, idrsnum, idrstmpl, mapdrslen, ierr) |
| This subroutine unpacks Section 5 (Data Representation Section) starting at octet 6 of that Section. More... | |
| subroutine | unpack6 (cgrib, lcgrib, iofst, ngpts, ibmap, bmap, ierr) |
| This subroutine unpacks Section 6 (Bit-Map Section) starting at octet 6 of that Section. More... | |
Contains subroutines obtain grid information and the unpacked data (section 3 - 6) for a field from a GRIB2 file.
Definition in file getfield.F90.
| subroutine getfield | ( | character(len = 1), dimension(lcgrib), intent(in) | cgrib, |
| integer, intent(in) | lcgrib, | ||
| integer, intent(in) | ifldnum, | ||
| integer, dimension(*), intent(out) | igds, | ||
| integer, dimension(*), intent(out) | igdstmpl, | ||
| integer, intent(out) | igdslen, | ||
| integer, dimension(*), intent(out) | ideflist, | ||
| integer, intent(out) | idefnum, | ||
| integer, intent(out) | ipdsnum, | ||
| integer, dimension(*), intent(out) | ipdstmpl, | ||
| integer, intent(out) | ipdslen, | ||
| real, dimension(*), intent(out) | coordlist, | ||
| integer, intent(out) | numcoord, | ||
| integer, intent(out) | ndpts, | ||
| integer, intent(out) | idrsnum, | ||
| integer, dimension(*), intent(out) | idrstmpl, | ||
| integer, intent(out) | idrslen, | ||
| integer, intent(out) | ibmap, | ||
| logical*1, dimension(*), intent(out) | bmap, | ||
| real, dimension(*), intent(out) | fld, | ||
| integer, intent(out) | ierr | ||
| ) |
This subroutine returns the Grid Definition, Product Definition, Bit-map (if applicable), and the unpacked data for a given data field.
Since there can be multiple data fields packed into a GRIB2 message, the calling routine indicates which field is being requested with the ifldnum argument.
| [in] | cgrib | Character array that contains the GRIB2 message. |
| [in] | lcgrib | Length (in bytes) of GRIB message array cgrib. |
| [in] | ifldnum | Specifies which field in the GRIB2 message to return. |
| [out] | igds | Contains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. Must be dimensioned >= 5.
|
| [out] | igdstmpl | Contains the data values for the specified Grid Definition Template (NN=igds(5)). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN. A safe dimension for this array can be obtained in advance from maxvals(2), which is returned from subroutine gribinfo(). |
| [out] | igdslen | Number of elements in igdstmpl. i.e. number of entries in Grid Defintion Template 3.NN (NN=igds(5)). |
| [out] | ideflist | (Used if igds(3) .ne. 0) This array contains the number of grid points contained in each row (or column). (part of Section 3) A safe dimension for this array can be obtained in advance from maxvals(3), which is returned from subroutine gribinfo(). |
| [out] | idefnum | (Used if igds(3) .ne. 0) The number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined. |
| [out] | ipdsnum | Product Definition Template Number (see Code Table 4.0). |
| [out] | ipdstmpl | Contains the data values for the specified Product Definition Template (N=ipdsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 4.N. A safe dimension for this array can be obtained in advance from maxvals(4), which is returned from subroutine gribinfo(). |
| [out] | ipdslen | Number of elements in ipdstmpl - i.e. number of entries in Product Defintion Template 4.N (N=ipdsnum). |
| [out] | coordlist | Array containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels (part of Section 4). The dimension of this array can be obtained in advance from maxvals(5), which is returned from subroutine gribinfo(). |
| [out] | numcoord | number of values in array coordlist. |
| [out] | ndpts | Number of data points unpacked and returned. |
| [out] | idrsnum | Data Representation Template Number (see Code Table 5.0). |
| [out] | idrstmpl | Contains the data values for the specified Data Representation Template (N=idrsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 5.N A safe dimension for this array can be obtained in advance from maxvals(6), which is returned from subroutine gribinfo(). |
| [out] | idrslen | Number of elements in idrstmpl. i.e. number of entries in Data Representation Template specified by idrsnum. |
| [out] | ibmap | Bitmap indicator (see Code Table 6.0).
|
| [out] | bmap | Logical*1 array containing decoded bitmap (if ibmap=0). The dimension of this array can be obtained in advance from maxvals(7), which is returned from subroutine gribinfo(). |
| [out] | fld | Array of ndpts unpacked data points. A safe dimension for this array can be obtained in advance from maxvals(7), which is returned from subroutine gribinfo(). |
| [out] | ierr | Error return code.
|
Definition at line 106 of file getfield.F90.
References comunpack(), g2_gbytec(), jpcunpack(), pngunpack(), rdieee(), simunpack(), unpack3(), unpack4(), unpack5(), and unpack6().
| subroutine unpack3 | ( | character(len = 1), dimension(lcgrib), intent(in) | cgrib, |
| integer, intent(in) | lcgrib, | ||
| integer, intent(inout) | iofst, | ||
| integer, dimension(*), intent(out) | igds, | ||
| integer, dimension(*), intent(out) | igdstmpl, | ||
| integer | mapgridlen, | ||
| integer, dimension(*), intent(out) | ideflist, | ||
| integer, intent(out) | idefnum, | ||
| integer, intent(out) | ierr | ||
| ) |
This subroutine unpacks Section 3 (Grid Definition Section) starting at octet 6 of that Section.
| [in] | cgrib | Character array that contains the GRIB2 message. |
| [in] | lcgrib | Length (in bytes) of GRIB message array cgrib. |
| [in,out] | iofst | Bit offset of the beginning (in) or the end (out) of Section 3. |
| [out] | igds | Contains information read from the appropriate GRIB Grid Definition Section 3 for the field being returned. Must be dimensioned >= 5.
|
| [out] | igdstmpl | Contains the data values for the specified Grid Definition Template (NN=igds(5)). Each element of this integer array contains an entry (in the order specified) of Grid Defintion Template 3.NN. |
| [out] | mapgridlen | Number of elements in igdstmpl - i.e. number of entries in Grid Defintion Template 3.NN (NN=igds(5)). |
| [out] | ideflist | (Used if igds(3) .ne. 0). This array contains the number of grid points contained in each row (or column) (part of Section 3). |
| [out] | idefnum | (Used if igds(3) .ne. 0). The number of entries in array ideflist - i.e. number of rows (or columns) for which optional grid points are defined. |
| [out] | ierr | Error return code.
|
Definition at line 374 of file getfield.F90.
References gridtemplates::extgridtemplate(), g2_gbytec(), g2_gbytesc(), and gridtemplates::getgridtemplate().
Referenced by getfield(), and gettemplates().
| subroutine unpack4 | ( | character(len = 1), dimension(lcgrib), intent(in) | cgrib, |
| integer, intent(in) | lcgrib, | ||
| integer, intent(inout) | iofst, | ||
| integer, intent(out) | ipdsnum, | ||
| integer, dimension(*), intent(out) | ipdstmpl, | ||
| integer | mappdslen, | ||
| real, dimension(*), intent(out) | coordlist, | ||
| integer, intent(out) | numcoord, | ||
| integer, intent(out) | ierr | ||
| ) |
This subroutine unpacks Section 4 (Product Definition Section) starting at octet 6 of that Section.
| [in] | cgrib | Character array that contains the GRIB2 message. |
| [in] | lcgrib | Length (in bytes) of GRIB message array cgrib. |
| [in,out] | iofst | Bit offset of the beginning (in) or the end (out) of Section 4. |
| [out] | ipdsnum | Product Definition Template Number (see Code Table 4.0). |
| [out] | ipdstmpl | Contains the data values for the specified Product Definition Template (N=ipdsnum). Each element of this integer array contains an entry (in the order specified) of Product Defintion Template 4.N. |
| [out] | mappdslen | Number of elements in ipdstmpl. i.e. number of entries in Product Defintion Template 4.N (N=ipdsnum). |
| [out] | coordlist- | Array containg floating point values intended to document the vertical discretisation associated to model data on hybrid coordinate vertical levels (part of Section 4). |
| [out] | numcoord | number of values in array coordlist. |
| [out] | ierr | Error return code.
|
Definition at line 504 of file getfield.F90.
References pdstemplates::extpdstemplate(), g2_gbytec(), g2_gbytesc(), pdstemplates::getpdstemplate(), and rdieee().
Referenced by getfield(), and gettemplates().
| subroutine unpack5 | ( | character(len = 1), dimension(lcgrib), intent(in) | cgrib, |
| integer, intent(in) | lcgrib, | ||
| integer, intent(inout) | iofst, | ||
| integer, intent(out) | ndpts, | ||
| integer, intent(out) | idrsnum, | ||
| integer, dimension(*), intent(out) | idrstmpl, | ||
| integer | mapdrslen, | ||
| integer, intent(out) | ierr | ||
| ) |
This subroutine unpacks Section 5 (Data Representation Section) starting at octet 6 of that Section.
| [in] | cgrib | Character array that contains the GRIB2 message. |
| [in] | lcgrib | Length (in bytes) of GRIB message array cgrib. |
| [in,out] | iofst | Bit offset of the beginning (in) or the end(out) of Section 5. |
| [out] | ndpts | Number of data points unpacked and returned. |
| [out] | idrsnum | Data Representation Template Number (see Code Table 5.0) |
| [out] | idrstmpl | Contains the data values for the specified Data Representation Template (N = idrsnum). Each element of this integer array contains an entry (in the order specified) of Data Representation Template 5.N. |
| [out] | mapdrslen | Number of elements in idrstmpl. i.e. number of entries in Data Representation Template 5.N (N = idrsnum). |
| [out] | ierr | Error return code.
|
Definition at line 613 of file getfield.F90.
References drstemplates::extdrstemplate(), g2_gbytec(), and drstemplates::getdrstemplate().
Referenced by getfield().
| subroutine unpack6 | ( | character(len = 1), dimension(lcgrib), intent(in) | cgrib, |
| integer, intent(in) | lcgrib, | ||
| integer, intent(inout) | iofst, | ||
| integer, intent(in) | ngpts, | ||
| integer, intent(out) | ibmap, | ||
| logical*1, dimension(ngpts), intent(out) | bmap, | ||
| integer, intent(out) | ierr | ||
| ) |
This subroutine unpacks Section 6 (Bit-Map Section) starting at octet 6 of that Section.
| [in] | cgrib | Character array that contains the GRIB2 message. |
| [in] | lcgrib | Length (in bytes) of GRIB message array cgrib. |
| [in,out] | iofst | Bit offset of the beginning (in) or the end (out) of Section 6. |
| [in] | ngpts | Number of grid points specified in the bit-map. |
| [out] | ibmap | Bitmap indicator (see Code Table 6.0).
|
| [out] | bmap | Logical*1 array containing decoded bitmap (if ibmap = 0). |
| [out] | ierr | Error return code.
|
Definition at line 709 of file getfield.F90.
References g2_gbytec(), and g2_gbytesc().
Referenced by getfield().