/usr/bin/grib_list is in python3-grib 1.9.8-1build2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #!/usr/bin/python3
import pygrib, sys
pygrib.tolerate_badgrib_on()
if len(sys.argv) < 2:
sys.stdout.write("'grib_list <grib_filename>' to get long listing\n")
sys.stdout.write("'grib_list <grib_filename> -s' to get short listing\n")
sys.stdout.write("'grib_list <grib_filename> -m' to get short listing plus data min/max\n")
sys.exit(1)
fname = sys.argv[1]
short = False
medium = False
if len(sys.argv) > 2:
if sys.argv[2] == '-s': short=True
if sys.argv[2] == '-m': medium=True
grbs = pygrib.open(fname)
if short:
for grb in grbs:
sys.stdout.write(repr(grb)+'\n')
elif medium:
for grb in grbs:
try:
grb.expand_grid(False); data = grb.values
sys.stdout.write(repr(grb)+':min/max=%g/%g'%(data.min(), data.max())+'\n')
except:
sys.stdout.write(repr(grb)+':min/max=NO DATA'+'\n')
else:
for grb in grbs:
sys.stdout.write('------message %d------\n' % grb.messagenumber)
for k in grb.keys():
if k.startswith('mars'): continue
if k in ['values','codedValues','packedValues','unpackedValues']: continue
if grb.is_missing(k):
sys.stdout.write('%s = MISSING\n' % k)
else:
try:
v = grb[k]
sys.stdout.write('%s = %s\n'%(k,v))
except:
sys.stdout.write('%s = NOT FOUND\n'%k)
sys.stdout.write('packing = %s\n' % grb.packingType)
grbs.close()
|