More flexible GRIB format identification

An alternative to #678.