Skip Navigation Links 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center

About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > wgrib2-geolocation

wgrib2: -geolocation


Geolocation routines are used to calculate the longitudes and latitudes of the grid points. Wgrib2 can use Proj4, gctpc and its own internal routines to do the geolocation. Each set of routines has advanages and disadvantages. The routines are listed in the default order.


The Proj library was called PROJ4 from 1994-2017. In 2018, PROJ v5 was released and the software was renamed PROJ. Wgrib2 is still using a v4 library and all references in the code are to PROJ4.

PROJ is the gold standard of geolocation libraries. It is commonly used and well supported. The drawbacks are it doesn't support OpenMP and model grids. As of wgrib2 v3.1.2, PROJ4 is installed by default in order to suppore aspherical equal area Lambert grids.


Gctpc is an older library was which has lost support of its original authors (USGS). The advantage is that it does support OpenMP unlike Proj4. It supports fewer grids than Proj4 but that isn't a major problem because the grib2 standard only has support for a few grids. Gctpc supports an ellipsoidal earth and is always compiled with wgrib2.


The internal routines are used to support model grids (Gaussian grid, rotated lat-lon grid), spherical earth grids, and observational grids such as the space-view grid (used by EUMETSAT) and radar grids (angle, distance from the origin).

External, wgrib2 v3.1.2+

Wgrib2 can set or overwrite the locations of the grid points using -rpn (sto_lat, sto_lon), reading from a grib file using -grid_def, and reading from a double precision binary file using -import_lonlat. These methods will set the geolocation flag to external.

For wgrib2 prior to v3.1.2, the geolocation flag showed which geolocation library generated the locations of the grid points. External methods were not considered.


    print out geolocation routines used: proj4, gctpc, internal, external, or not_used
      external means the lat/lon may be read or computed by an external calculation.
      If wgrib3 does not need the geolocation information, the geolocation routines
         will not be called. 


$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation -lon -90 30 

	The gctpc routines were used for geolocation.

$ wgrib2 burned_area_20120131_12_23_1km.grib2 -geolocation

	The geolocation use not used.
See also: -gctpc -grid_def -import_lonlat -proj4 -rpn

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page dates: created 4/13/2020, modified 10/2022, 1/2023
Disclaimer Privacy Policy