wgrib2: -lon

Introduction

The -lon option prints the value of the grid point
closest to the specified longitude latitude. The latitude-longitude of the grid
point are also printed. If you use the verbose mode, the grid
coordinates (i,j) and the number of the element are also printed.
The -lon option can be repeated to save processing
time.

In the latter example, the point at lon=240.008805,lat=29.988418 is the 220037th
element in the array and its coordinates are (72,206). Note that these coordinates
are after the data has been converted into a WE:SN scan order.

Want Speed?

You want extract the values for a 1000 different points.
So you call wgrib2 1000 times and complain that wgrib2 is slow.
Well decoding a jpeg2000 compressed file 1000 times does take time.
It's better to add a 1000 -lon options to the
command line and only decode the file once.

The number of -lon options on a
command line is limited by a compile-time option. Try
running wgrib2 -config and look for the line
"maximum number of arguments on command line:". The current
value is 5000 which allows you 5000 words on the command line. Each
-lon option takes 3 words, so that gives
you about 1600 -lon options you can run
on one line. Of course, limitations such as the maximum line
length or maximum number of continuations may stop you first.