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.
Any number of -lon options can be used.
-sh-2.05b$ wgrib2 eta.t00z.awphys18.grb2 -d 1 -s -lon 249 39 -lon 255 33
1:0:d=2003090300:MSLET:mean sea level:18 hour fcst:lon=249.035,lat=38.9912,val=101685:
lon=254.964,lat=32.9671,val=101668
-sh-3.00$ wgrib2 rtma.t12z.2dvaranl_ndfd.grb2.c2 -d 1 -v -lon -120 30
1:0:lon=240.008805,lat=29.988418,i=220037,ix=72,iy=206,val=0
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.
Usage
-lon LONGITUDE LATITUDE
LONGITUDE = 0 .. 360
LATITUDE = -90 .. 90
Example
$ wgrib2 test.grb2 -s -lon -90 20
1:0:d=2005090200:HGT:1000 mb:60 hour fcst:lon=270,lat=20,val=121.3
2:133907:d=2005090200:HGT:975 mb:60 hour fcst:lon=270,lat=20,val=344.4
3:263511:d=2005090200:HGT:950 mb:60 hour fcst:lon=270,lat=20,val=573
4:389058:d=2005090200:HGT:925 mb:60 hour fcst:lon=270,lat=20,val=806.5
...
Want Speed?
You want extract the values for a 1000 different points.
So you call wgrib2 5000 time and complain that wgrib2 is slow.
Well decoding a jpeg2000 compressed file does take time.
- convert the file to simple packing which is faster to read
- run the 1000 wgrib2 jobs on 1000 CPUs. This works for me. :)
- convert the 1000 wgrib2 jobs into 1 wgrib2 job.
Running 1000 wgrib2 jobs is inefficient because you are uncompressing
the file 1000 times! On feature of wgrib2 is that options can be
repeated.
Uncompressing file 3 times - SLOW
$ wgrib2 -lon lon1 lat1 >value.dat
$ wgrib2 -lon lon2 lat2 >>value.dat
$ wgrib2 -lon lon3 lat3 >>value.dat
Uncompressing file 1 time - FAST
$ wgrib2 -lon lon1 lat1 -lon lon2 lat2 -lon lon3 lat3 >value.dat
The current wgrib2 (1.9.5.1) is configured for 5000 arguements on the
command line and is easily changed for more. That means you can extract up
to 1000 points at one time. (see wgrib2 -config) If you want more
speed, you can start multitasking.
(pipes, for_n)
See also: -lola
See also: -config
|