Can you put short comments at the start of each block to describe what is happening. The GRIB missing value handling is rather difficult to get to grips with so a bit of explanation would go a long way here!