GRIB messages are at the moment exchanged in edition 1 or 2. Although the information content of two messages in different editions is almost the same, their binary format is very different and organised in a different way.
The conversion from grib edition 1 (grib1) to edition 2 (grib2) is a format translation without any loss of information. Conversely the conversion from grib2 to grib1 is not always lossless because the edition 2 format has been extended to allow a wider set of scientific fields to be coded.
Since the new grib2 format is going to replace grib1 we will focus more on the grib1 to grib2 conversion rather than the opposite, which sometimes is not possible.
The conversion algorithm should be easy to implement, but there are some factors making it challenging. First of all the new designed grib2 is in some points semantically different from grib1. Therefore it doesn't allow an easy mapping of the meaning across the two versions. Moreover some of the numeric code tables semantically identical are numerically different, which doesn't allow again an easy mapping between them, because the numeric codes for the same information element are different. We refer in particular to the type of level which is numerically different in the two editions.
Another element to be considered in a conversion algorithm is that many meteorological operational centres have been developing local patches to the GRIB specification to overcome the limitations of grib1. This local extensions or local tables are not coherent and sometimes are not properly organised. It is widespread, for example, the use of local parameter tables.
The aim of the conversion facilities provided in GRIB API is to be flexible enough to define conversion rules also for local tables and local extensions and to allow the user to configure locally the library to interpret fields coded in a local flavour of the grib specifications.