📄 grib2.doc
字号:
C THIS ROUTINE.C LUGI INTEGER UNIT OF THE UNBLOCKED GRIB INDEX FILE.C IF NONZERO, FILE MUST BE OPENED WITH BAOPEN BAOPENR BEFORE C CALLING THIS ROUTINE.C >0 - READ INDEX FROM INDEX FILE LUGI, IF INDEX DOESN"TC ALREADY EXIST.C =0 - TO GET INDEX BUFFER FROM THE GRIB FILE, IF INDEXC DOESN"T ALREADY EXIST.C <0 - FORCE REREAD OF INDEX FROM INDEX FILE ABS(LUGI).C =LUGB - FORCE REGENERATION OF INDEX FROM GRIB2 FILE LUGB.C J INTEGER NUMBER OF FIELDS TO SKIPC (=0 TO SEARCH FROM BEGINNING)C JDISC GRIB2 DISCIPLINE NUMBER OF REQUESTED FIELDC ( IF = -1, ACCEPT ANY DISCIPLINE)C ( SEE CODE TABLE 0.0 )C 0 - Meteorological productsC 1 - Hydrological productsC 2 - Land surface productsC 3 - Space productsC 10 - Oceanographic productsC JIDS() INTEGER ARRAY OF VALUES IN THE IDENTIFICATION SECTIONC (=-9999 FOR WILDCARD)C JIDS(1) = IDENTIFICATION OF ORIGINATING CENTREC ( SEE COMMON CODE TABLE C-1 )C JIDS(2) = IDENTIFICATION OF ORIGINATING SUB-CENTREC JIDS(3) = GRIB MASTER TABLES VERSION NUMBERC ( SEE CODE TABLE 1.0 )C 0 - ExperimentalC 1 - Initial operational version numberC JIDS(4) = GRIB LOCAL TABLES VERSION NUMBERC ( SEE CODE TABLE 1.1 )C 0 - Local tables not usedC 1-254 - Number of local tables version usedC JIDS(5) = SIGNIFICANCE OF REFERENCE TIME (CODE TABLE 1.2)C 0 - AnalysisC 1 - Start of forecastC 2 - Verifying time of forecastC 3 - Observation timeC JIDS(6) = YEAR ( 4 DIGITS )C JIDS(7) = MONTHC JIDS(8) = DAYC JIDS(9) = HOURC JIDS(10) = MINUTEC JIDS(11) = SECONDC JIDS(12) = PRODUCTION STATUS OF PROCESSED DATAC ( SEE CODE TABLE 1.3 )C 0 - Operational productsC 1 - Operational test productsC 2 - Research productsC 3 - Re-analysis productsC JIDS(13) = TYPE OF PROCESSED DATA ( SEE CODE TABLE 1.4 )C 0 - Analysis productsC 1 - Forecast productsC 2 - Analysis and forecast productsC 3 - Control forecast productsC 4 - Perturbed forecast productsC 5 - Control and perturbed forecast productsC 6 - Processed satellite observationsC 7 - Processed radar observationsC JPDTN INTEGER PRODUCT DEFINITION TEMPLATE NUMBER (N)C ( IF = -1, DON'T BOTHER MATCHING PDT - ACCEPT ANY )C JPDT() INTEGER ARRAY OF VALUES DEFINING THE PRODUCT DEFINITIONC TEMPLATE 4.N OF THE FIELD FOR WHICH TO SEARCHC (=-9999 FOR WILDCARD)C JGDTN INTEGER GRID DEFINITION TEMPLATE NUMBER (M)C ( IF = -1, DON'T BOTHER MATCHING GDT - ACCEPT ANY )C JGDT() INTEGER ARRAY OF VALUES DEFINING THE GRID DEFINITIONC TEMPLATE 3.M OF THE FIELD FOR WHICH TO SEARCHC (=-9999 FOR WILDCARD)C UNPACK LOGICAL VALUE INDICATING WHETHER TO UNPACK BITMAP/DATAC .TRUE. = UNPACK BITMAP AND DATA VALUESC .FALSE. = DO NOT UNPACK BITMAP AND DATA VALUESCC OUTPUT ARGUMENTS:C K INTEGER FIELD NUMBER UNPACKEDC gfld - derived type gribfield ( defined in module grib_mod )C ( NOTE: See Remarks Section )C gfld%version = GRIB edition number ( currently 2 )C gfld%discipline = Message Discipline ( see Code Table 0.0 )C gfld%idsect() = Contains the entries in the IdentificationC Section ( Section 1 )C This element is actually a pointer to an arrayC that holds the data.C gfld%idsect(1) = Identification of originating CentreC ( see Common Code Table C-1 )C 7 - US National Weather ServiceC gfld%idsect(2) = Identification of originating Sub-centreC gfld%idsect(3) = GRIB Master Tables Version NumberC ( see Code Table 1.0 )C 0 - ExperimentalC 1 - Initial operational version numberC gfld%idsect(4) = GRIB Local Tables Version NumberC ( see Code Table 1.1 )C 0 - Local tables not usedC 1-254 - Number of local tables version usedC gfld%idsect(5) = Significance of Reference Time (Code Table 1.2)C 0 - AnalysisC 1 - Start of forecastC 2 - Verifying time of forecastC 3 - Observation timeC gfld%idsect(6) = Year ( 4 digits )C gfld%idsect(7) = MonthC gfld%idsect(8) = DayC gfld%idsect(9) = HourC gfld%idsect(10) = MinuteC gfld%idsect(11) = SecondC gfld%idsect(12) = Production status of processed dataC ( see Code Table 1.3 )C 0 - Operational productsC 1 - Operational test productsC 2 - Research productsC 3 - Re-analysis productsC gfld%idsect(13) = Type of processed data ( see Code Table 1.4 )C 0 - Analysis productsC 1 - Forecast productsC 2 - Analysis and forecast productsC 3 - Control forecast productsC 4 - Perturbed forecast productsC 5 - Control and perturbed forecast productsC 6 - Processed satellite observationsC 7 - Processed radar observationsC gfld%idsectlen = Number of elements in gfld%idsect().C gfld%local() = Pointer to character array containing contentsC of Local Section 2, if includedC gfld%locallen = length of array gfld%local()C gfld%ifldnum = field number within GRIB messageC gfld%griddef = Source of grid definition (see Code Table 3.0)C 0 - Specified in Code table 3.1C 1 - Predetermined grid Defined by originating centreC gfld%ngrdpts = Number of grid points in the defined grid.C gfld%numoct_opt = Number of octets needed for eachC additional grid points definition.C Used to define number ofC points in each row ( or column ) forC non-regular grids.C = 0, if using regular grid.C gfld%interp_opt = Interpretation of list for optional pointsC definition. (Code Table 3.11)C gfld%igdtnum = Grid Definition Template Number (Code Table 3.1)C gfld%igdtmpl() = Contains the data values for the specified GridC Definition Template ( NN=gfld%igdtnum ). EachC element of this integer array contains an entry (inC the order specified) of Grid Defintion Template 3.NNC This element is actually a pointer to an arrayC that holds the data.C gfld%igdtlen = Number of elements in gfld%igdtmpl(). i.e. number ofC entries in Grid Defintion Template 3.NNC ( NN=gfld%igdtnum ).C gfld%list_opt() = (Used if gfld%numoct_opt .ne. 0) This arrayC contains the number of grid points contained inC each row ( or column ). (part of Section 3)C This element is actually a pointer to an arrayC that holds the data. This pointer is nullifiedC if gfld%numoct_opt=0.C gfld%num_opt = (Used if gfld%numoct_opt .ne. 0) The number of entriesC in array ideflist. i.e. number of rows ( or columns )C for which optional grid points are defined. This valueC is set to zero, if gfld%numoct_opt=0.C gfdl%ipdtnum = Product Definition Template Number (see Code Table 4.0)C gfld%ipdtmpl() = Contains the data values for the specified ProductC Definition Template ( N=gfdl%ipdtnum ). Each elementC of this integer array contains an entry (in theC order specified) of Product Defintion Template 4.N.C This element is actually a pointer to an arrayC that holds the data.C gfld%ipdtlen = Number of elements in gfld%ipdtmpl(). i.e. number ofC entries in Product Defintion Template 4.NC ( N=gfdl%ipdtnum ).C gfld%coord_list() = Real array containing floating point valuesC intended to document the vertical discretisationC associated to model data on hybrid coordinateC vertical levels. (part of Section 4)C This element is actually a pointer to an arrayC that holds the data.C gfld%num_coord = number of values in array gfld%coord_list().C gfld%ndpts = Number of data points unpacked and returned.C gfld%idrtnum = Data Representation Template NumberC ( see Code Table 5.0)C gfld%idrtmpl() = Contains the data values for the specified DataC Representation Template ( N=gfld%idrtnum ). EachC element of this integer array contains an entryC (in the order specified) of Product DefintionC Template 5.N.C This element is actually a pointer to an arrayC that holds the data.C gfld%idrtlen = Number of elements in gfld%idrtmpl(). i.e. numberC of entries in Data Representation Template 5.NC ( N=gfld%idrtnum ).C gfld%unpacked = logical value indicating whether the bitmap andC data values were unpacked. If false,C gfld%bmap and gfld%fld pointers are nullified.C gfld%expanded = Logical value indicating whether the data fieldC was expanded to the grid in the case where aC bit-map is present. If true, the data points inC gfld%fld match the grid points and zeros wereC inserted at grid points where data was bit-mappedC out. If false, the data values in gfld%fld wereC not expanded to the grid and are just a consecutiveC array of data points corresponding to each value ofC "1" in gfld%bmap.C gfld%ibmap = Bitmap indicator ( see Code Table 6.0 )C 0 = bitmap applies and is included in Section 6.C 1-253 = Predefined bitmap appliesC 254 = Previously defined bitmap applies to this fieldC 255 = Bit map does not apply to this product.C gfld%bmap() = Logical*1 array containing decoded bitmap,C if ibmap=0 or ibap=254. Otherwise nullified.C This element is actually a pointer to an arrayC that holds the data.C gfld%fld() = Array of gfld%ndpts unpacked data points.C This element is actually a pointer to an arrayC that holds the data.C IRET INTEGER RETURN CODEC 0 ALL OKC 96 ERROR READING INDEXC 97 ERROR READING GRIB FILEC 99 REQUEST NOT FOUNDC OTHER GF_GETFLD GRIB2 UNPACKER RETURN CODECC SUBPROGRAMS CALLED:C GETIDX GET INDEXC GETGB2S SEARCH INDEX RECORDSC GETGB2R READ AND UNPACK GRIB RECORDC GF_FREE FREES MEMORY USED BY GFLD ( SEE REMARKS )CC REMARKS: SPECIFY AN INDEX FILE IF FEASIBLE TO INCREASE SPEED.C DO NOT ENGAGE THE SAME LOGICAL UNIT FROM MORE THAN ONE PROCESSOR.CC Note that derived type gribfield contains pointers to manyC arrays of data. The memory for these arrays is allocatedC when the values in the arrays are set, to help minimizeC problems with array overloading. Because of this usersC are encouraged to free up this memory, when it is no longerC needed, by an explicit call to subroutine gf_free.C ( i.e. CALL GF_FREE(GFLD) )CC ATTRIBUTES:C LANGUAGE: FORTRAN 90CC$$$
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -