NCEPLIBS-g2  3.4.5
g2grids Module Reference

This Fortran Module allows access to predefined GRIB2 Grid Definition Templates stored in a file. More...

Functions/Subroutines

subroutine getgridbyname (lunit, name, igdtn, igdtmpl, iret)
 This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assigned to the requested name. More...
 
subroutine getgridbynum (lunit, number, igdtn, igdtmpl, iret)
 This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assigned to the requested number. More...
 
integer function readgrids (lunit)
 This function reads the list of GDT entries in the file associated with fortran unit, lunit. More...
 

Variables

integer, parameter maxtemp =200
 maximum template number for grid definition. More...
 
integer num_grids =0
 the number of grids. More...
 

Detailed Description

This Fortran Module allows access to predefined GRIB2 Grid Definition Templates stored in a file.

The GDTs are represented by a predefined number or a character abbreviation. At the first request, all the grid GDT entries in the file associated with input Fortran file unit number, lunit, are read into a linked list named gridlist. This list is searched for the requested entry. Users of this Fortran module should only call routines getgridbynum and getgridbyname.

The format of the file scanned by routines in this module is as follows. Each line contains one Grid entry containing five fields, each separated by a colon, ":". The fields are:

  • 1) - predefined grid number
  • 2) - Up to an 8 character abbreviation
  • 3) - Grid Definition Template number
  • 4) - Number of entries in the Grid Definition Template
  • 5) - A list of values for each entry in the Grid Definition Template. As an example, this is the entry for the 1x1 GFS global grid 3:gbl_1deg: 0:19: 0 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0
Author
Stephen Gilbert
Date
2004-04-27

Function/Subroutine Documentation

◆ getgridbyname()

subroutine g2grids::getgridbyname ( integer, intent(in)  lunit,
character(len=8), intent(in)  name,
integer, intent(out)  igdtn,
integer, dimension(*), intent(out)  igdtmpl,
integer, intent(out)  iret 
)

This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assigned to the requested name.

The input file format is described at the top of this module.

Parameters
[in]lunitUnit number of file containing Grid definitions
[in]nameGrid name of the requested Grid definition
[out]igdtnNN, indicating the number of the Grid Definition Template 3.NN
[out]igdtmplAn array containing the values of each entry in the Grid Definition Template.
[out]iretError return code.
  • 0 no error
  • -1 Undefined Grid name.
  • 3 Could not read any grids from file.
Author
Stephen Gilbert
Date
2004-04-26

Definition at line 212 of file g2grids.f.

◆ getgridbynum()

subroutine g2grids::getgridbynum ( integer, intent(in)  lunit,
integer, intent(in)  number,
integer, intent(out)  igdtn,
integer, dimension(*), intent(out)  igdtmpl,
integer, intent(out)  iret 
)

This subroutine searches a file referenced by fortran unit lunit for a Grid Definition Template assigned to the requested number.

The input file format is described at the top of this module.

Parameters
[in]lunitUnit number of file containing Grid definitions
[in]numberGrid number of the requested Grid definition
[out]igdtnNN, indicating the number of the Grid Definition Template 3.NN
[out]igdtmplAn array containing the values of each entry in the Grid Definition Template.
[out]iretError return code.
  • 0 no error
  • -1 Undefined Grid number.
  • 3 Could not read any grids from file.
Author
Stephen Gilbert
Date
2004-04-26

Definition at line 150 of file g2grids.f.

◆ readgrids()

integer function g2grids::readgrids ( integer, intent(in)  lunit)

This function reads the list of GDT entries in the file associated with fortran unit, lunit.

All the entries are stored in a linked list called gridlist.

Parameters
[in]lunitFortran unit number associated the the GDT file.
Returns
The number of Grid Definition Templates read in.
Author
Stephen Gilbert
Date
2001-06-28

Definition at line 58 of file g2grids.f.

Variable Documentation

◆ maxtemp

integer, parameter g2grids::maxtemp =200

maximum template number for grid definition.

Definition at line 32 of file g2grids.f.

◆ num_grids

integer g2grids::num_grids =0

the number of grids.

Definition at line 44 of file g2grids.f.