Skip Navigation Links www.nws.noaa.gov 
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 -last
 

wgrib2: -last

Introduction

The -last FILE option writes the results of the previous option to FILE. The FILE can be a disk file, temporary file or memory file. If the -last option preceeds any inventory options, then the "grib message number[.submessage number:byte location" will be written to the file.

The -last option was designed for callable wgrib2 to obtain inventory information. Note the -s_out FILE option should be replaced by the more powerful -s -last FILE syntax.

The -last option does not write to the inventory, so if you have two consecutive -last options, the second -last will have no output. With wgrib2 v3.0.0+, the -last and -last0 options will not clear the last option output buffer. So the the second -last option will have the same output as the immediately preceeding -last or -last0 option.

Usage

-last FILE

Example

Suppose you want a the grid values (nearest neighbor) for 1000 points. You could do something like this,
$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 0 10 > point1.txt
$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 20 50 > point2.txt
...
$ wgrib2 gep19.t00z.pgrb2af180 -s -lon 250 40 > point1000.txt
This would not be the fastest because you have to read and decode the input file 1000 times. You could read and decode the file once by using the -last option. Here how to do it using N=2.
wgrib2 gep19.t00z.pgrb2af180 -s -last point1.txt -last point2.txt \
    -print_out ':' point1.txt -lon 0 0 -last point1.txt -nl_out point1.txt \
    -print_out ':' point2.txt  -lon 10 20 -last point2.txt -nl_out point2.txt

The -new_grid option can interpolate to set of user defined grid points. See also: -last0 -new_grid


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 last modified: July 1, 2015, March 5, 2018, June 2, 2020, June 23, 2021
Disclaimer Privacy Policy