Problem

You try to retrieve data from the ECMWF data archive in netCDF format but the retrieval fails with this message:

ECCODES ERROR : Wrong number of fields
ECCODES ERROR : File contains 806 GRIBs, 806 left in internal description, 745 in request
ECCODES ERROR : The fields are not considered distinct!
ECCODES ERROR : Hint: This may be due to several fields having the same validity time.
ECCODES ERROR : Try using the -T option (Do not use time of validity)

This can occur if:

  • you request forecast data in netCDF format
  • your data request contains overlapping "time"+"step" specifications

For example, for the ERA-Interim dataset there are two daily forecasts (00:00, 12:00), with 3-hourly forecast steps. So one could specify in a data retrieval script:

"date":"2016-12-01"
"type":"fc"
"time": "00:00/12:00",
"step": "3/6/9/12/15",
"format": "netcdf"

With the above specification you get data for the following validity times:

  • time 00:00 + step 3  validity time 2016-12-01, 03:00
  • time 00:00 + step 6  validity time 2016-12-01, 06:00
  • time 00:00 + step 9  validity time 2016-12-01, 09:00
  • time 00:00 + step 12 → validity time 2016-12-01, 12:00
  • time 00:00 + step 15 → validity time 2016-12-01, 15:00
  • time 12:00 + step 3  validity time 2016-12-01, 15:00
  • time 12:00 + step 6  validity time 2016-12-01, 18:00
  • time 12:00 + step 9  validity time 2016-12-01, 21:00
  • time 12:00 + step 12 → validity time 2016-12-02, 00:00
  • time 12:00 + step 15 → validity time 2016-12-02, 03:00

In this example you get two data values at the same validity time 2016-12-01, 15:00.  The netCDF format does not support multiple data values at a single time, hence the creation of the output netCDF file fails, triggering the error message.

Solution

The solution is:

  • Retrieve the data in its native GRIB format, which supports multiple data values at any one validity time.
    Then convert the data from GRIB to NetCDF format using the grib_to_netcdf tool with the -T option.
  • Retrieve data for each forecast "time" separately, for example for ERA-Interim:
    • first with time = 00:00 and all required steps
    • then with time = 12:00 and all required steps