NCEPLIBS-g2  3.4.7
getidx.F90 File Reference

Find, read or generate a GRIB2 index for the GRIB2 file associated with unit lugb. More...

Go to the source code of this file.

Functions/Subroutines

subroutine getidx (lugb, lugi, cindex, nlen, nnum, iret)
 Find, read or generate a GRIB2 index for the GRIB2 file associated with unit lugb. More...
 
subroutine gf_finalize (iret)
 Free all memory associated with the library. More...
 

Detailed Description

Find, read or generate a GRIB2 index for the GRIB2 file associated with unit lugb.

Author
Stephen Gilbert
Date
2005-03-15

Definition in file getidx.F90.

Function/Subroutine Documentation

◆ getidx()

subroutine getidx ( integer, intent(in)  lugb,
integer, intent(in)  lugi,
character(len = 1), dimension(:), pointer  cindex,
integer, intent(out)  nlen,
integer, intent(out)  nnum,
integer, intent(out)  iret 
)

Find, read or generate a GRIB2 index for the GRIB2 file associated with unit lugb.

If the index already exists, it is returned, otherwise, the index is (1) read from an existing indexfile associated with unit lugi or (2) generated from the GRIB2 file lugb.

Users can force a regeneration of an index: if lugi equals lugb, the index will be regenerated from the data in file lugb. If lugi is less than zero, then the index is re-read from index file abs(lugi).

This subroutine allocates memory and stores the resulting pointers in an array that is a Fortran "save" variable. The result is that the memory will not be freed by the library and cannot be reached by the caller. To free this memory call gf_finalize() after all library operations are complete.

Note
The file unit numbers must be in range 1 - 9999.
Parameters
[in]lugbinteger unit of the GRIB2 data file. File must have been opened with baopen() or baopenr() before calling this routine. If 0, then all saved memory will be released.
[in]lugiinteger unit of the GRIB2 index file. If nonzero, file must have been opened with baopen() or baopenr() before calling this routine. Set to 0 to get index information from the GRIB2 file.
[in,out]cindexcharacter*1 Pointer to a buffer that will get index records.
[out]nleninteger Total length of all index records.
[out]nnuminteger Number of index records.
[out]iretinteger Return code:
  • 0 No error.
  • 90 Unit number out of range.
  • 96 Error reading/creating index file.
Author
Stephen Gilbert
Date
2005-03-15

Definition at line 43 of file getidx.F90.

References getg2i(), and getg2ir().

Referenced by getgb2(), and gf_finalize().

◆ gf_finalize()

subroutine gf_finalize ( integer, intent(out)  iret)

Free all memory associated with the library.

Parameters
[out]iretinteger Return code:
  • 0 No error.
  • otherwise Error freeing internal resources.
Author
Ed Hartnett
Date
7/16/23

Definition at line 160 of file getidx.F90.

References getidx().