Problem
If you have a GRIB file with both Control and Perturbed forecasts, grib_to_netcdf will only convert the Perturbed Forecast. From 51 members present in the GRIB file, only 50 appear in the netCDF file.
% grib_to_netcdf -o output.nc input.grib ... grib_to_netcdf: Found 51 GRIB fields in 1 file. ... grib_to_netcdf: Done. % ncinfo output.nc ... dimensions(sizes): longitude(26), latitude(31), number(50), time(1)
This only occurs when 'type=pf and type=cf' fields coexist in the same file (common use case if you get real-time data).
Solution
The solution is to set the type=pf for the control forecast. Once converted the Control Forecast will appear as 'ensemble_number' = 0 in the NetCDF file.
% grib_set -s type=pf -w type=cf input.grib input2.grib % grib_to_netcdf -o output.nc input2.grib