/usr/bin/cnvgrib2to1 is in python-grib 1.9.3-1.
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 | #!/usr/bin/python
import pygrib, sys
if len(sys.argv) < 3:
sys.stdout.write("""
cnvgrib2to1 <grib2 filename> <grib1 filename>\n\n""")
raise SystemExit
grbs = pygrib.open(sys.argv[1])
f = open(sys.argv[2],'wb')
sys.stdout.write('converting %s from grib2 to grib1 (%s) ...\n' % (sys.argv[1],sys.argv[2]))
nmsg = 0
for grb in grbs:
try:
grb.editionNumber=1
nmsg = nmsg + 1
except:
sys.stdout.write('cannot convert message %s\n' % grb.messagenumber)
continue
f.write(grb.tostring())
sys.stdout.write('%s messages out of %s converted\n' % (nmsg,grbs.messages))
grbs.close()
f.close()
|