ecmwf/cfgrib

to_grib not able to write ensemble forecasts in GRIB v1 ?

jodemaey opened this issue · 3 comments

Hi there,

I'm presently trying to load, modify and rewrite ECMWF perturbed members using to_grib in GRIB v1, and despite all the other needed keys being there, the keys perturbationNumber and numberOfForecastsInEnsemble are not present in the final output file.

All the members are present in the output grib file but it is impossible to know which member is which one. Therefore, later I cannot reload correctly once gain using cf_grib.

Is there a way to do it properly or this is not yet implemented?

Thank you in advance,

Jonathan

The GRIB edition 1 standard does not include ensemble forecasts. We have to use a "local definition" to store the perturbation number etc
See https://apps.ecmwf.int/codes/grib/format/grib1/local/

Oh I see, then I guess using a local definition is not possible with to_grib , right? Or is it possible?

Ok I switched to v2 and it worked. Up to you to see if you want this to remain open or not.

Edit: FYI, even in v2, I had to impose the perturbationNumber by hand via grib_keys because to_grib was not picking it from my xarray dataset coordinate number.