Project

General

Profile

netcdf to grib error

Added by Neeldip Barman over 4 years ago

Hi,
I am trying to covert NCAR ERA5 reanalysis meteorological file to GRIB2 format. I am getting the following error:

cdo copy: 4%GRIB_API ERROR : concept: no match for shortName=utc_date
!!! grib_set_string( grib_handle h, "shortName", "utc_date") !!!
Warning (gribapiDefParam): grib_api: No match for shortName=utc_date
cdo copy: Processed 2 variables over 24 timesteps [847.72s 338MB].

I am using the command cdo -f grb2 copy inputfile.nc outputfile.grib2. I am using cdo 1.9.7.1.

Also it shows only 2 variables were processed while the input file has several meteorological variables. How can I process all the variables?
I am completely new to CDO and have very little knowledge on it. Kindly help me.

regards,
Neeldip


Replies (9)

RE: netcdf to grib error - Added by Karin Meier-Fleischer over 4 years ago

Hi Neeldip,

without your data file it is not possible to say what is going wrong. Please upload it.

-Karin

RE: netcdf to grib error - Added by Neeldip Barman over 4 years ago

Hi,
Thanks for the prompt reply. I have uploaded the file on Google drive as it is bigger than the maximum allowed size.
Link: https://drive.google.com/open?id=1AlxezomAcETpRlggnXClq-3Ti96XYprf

Regards,
neeldip

RE: netcdf to grib error - Added by Neeldip Barman over 4 years ago

Hi Karin,
Is there any update regarding the issue? If required I can provide a smaller data file now.

Best,
Neeldip

RE: netcdf to grib error - Added by Karin Meier-Fleischer over 4 years ago

There are only two variables in the data file: PV and utc_date.

ncdump -h e5.oper.an.pl.128_060_pv.ll025sc.2010010100_2010010123.nc

netcdf e5.oper.an.pl.128_060_pv.ll025sc.2010010100_2010010123 {
dimensions:
    time = UNLIMITED ; // (24 currently)
    level = 37 ;
    latitude = 721 ;
    longitude = 1440 ;
variables:
    float PV(time, level, latitude, longitude) ;
        PV:long_name = "Potential vorticity" ;
        PV:short_name = "pv" ;
        PV:units = "K m**2 kg**-1 s**-1" ;
        PV:original_format = "WMO GRIB 1 with ECMWF local table" ;
        PV:ecmwf_local_table = 128 ;
        PV:ecmwf_parameter = 60 ;
        PV:_FillValue = 9.999e+20f ;
        PV:missing_value = 9.999e+20f ;
        PV:minimum_value = -0.00851059f ;
        PV:maximum_value = 0.0336237f ;
        PV:grid_specification = "0.25 degree x 0.25 degree from 90N to 90S and 0E to 359.75E (721 x 1440 Latitude/Longitude)" ;
        PV:rda_dataset = "ds633.0" ;
        PV:rda_dataset_url = "https:/rda.ucar.edu/datasets/ds633.0/" ;
        PV:rda_dataset_doi = "DOI: 10.5065/BH6N-5N20" ;
        PV:rda_dataset_group = "ERA5 atmospheric pressure level analysis [netCDF4]" ;
        PV:number_of_significant_digits = 7 ;
    double latitude(latitude) ;
        latitude:long_name = "latitude" ;
        latitude:short_name = "lat" ;
        latitude:units = "degrees_north" ;
        latitude:qualifier = "Gaussian" ;
    double level(level) ;
        level:long_name = "pressure level" ;
        level:short_name = "plev" ;
        level:units = "hPa" ;
        level:alternate_units = "millibar" ;
    double longitude(longitude) ;
        longitude:long_name = "longitude" ;
        longitude:short_name = "lon" ;
        longitude:units = "degrees_east" ;
    int time(time) ;
        time:long_name = "time" ;
        time:units = "hours since 1900-01-01 00:00:00" ;
        time:calendar = "gregorian" ;
    int utc_date(time) ;
        utc_date:long_name = "UTC date yyyy-mm-dd hh:00:00 as yyyymmddhh" ;
        utc_date:units = "Gregorian_year month day hour" ;

// global attributes:
        :DATA_SOURCE = "ECMWF: https://cds.climate.copernicus.eu, Copernicus Climate Data Store" ;
        :NETCDF_CONVERSION = "CISL RDA: Conversion from ECMWF GRIB 1 data to netCDF4." ;
        :NETCDF_VERSION = "4.6.3" ;
        :CONVERSION_PLATFORM = "Linux r9i4n25 4.12.14-94.41-default #1 SMP Wed Oct 31 12:25:04 UTC 2018 (3090901) x86_64 x86_64 x86_64 GNU/Linux" ;
        :CONVERSION_DATE = "Mon Aug 19 15:37:01 MDT 2019" ;
        :Conventions = "CF-1.6" ;
        :NETCDF_COMPRESSION = "NCO: Precision-preserving compression to netCDF4/HDF5 (see \"history\" and \"NCO\" global attributes below for specifics)." ;
        :history = "Mon Aug 19 15:37:18 2019: ncks -4 --ppc default=7 e5.oper.an.pl.128_060_pv.ll025sc.2010010100_2010010123.unc.nc e5.oper.an.pl.128_060_pv.ll025sc.2010010100_2010010123.nc" ;
        :NCO = "netCDF Operators version 4.7.9 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)" ;
}

Ralf Müller wrote in https://code.mpimet.mpg.de/boards/1/topics/3745?r=3749#message-3749:
---
There is a fundamental difference between netcdf and grib2

  • netcdf is a self-descibing file format
    • shortnames have to be uniq
    • your are free to define global of variable attributes
    • your are free to create any kind of dimensions
  • grib1 and grib2 are standards from the WMO
    • main purpose is having a global standard to be able to chare data worldwide - that's why
    • data parameters (names,units,..) are moreless FIXED:
    • information about these things is stored in text-tables coming with the reference implementation grib_api. You are free to add things in so called local tables for you own need, but you will not be able to chare these data sets with other grib2 users, because you table are let's-say private

HENCE: There is no general way to convert arbitrary netcdf files into grib2 format.

The CDO-Warning is about exactly this problem: the netcdf shortname is not part of the grib2 standard, so things cannot be converted out-of-the-box.
---
Nevertheless, the GRIB2 file should be generated and the GRIB-API error can be ignored. If the error message bothers you anyway then use NCO's ncks to delete the utc_date variable.

-Karin

RE: netcdf to grib error - Added by Neeldip Barman over 4 years ago

Karin Meier-Fleischer wrote:

There are only two variables in the data file: PV and utc_date.

ncdump -h e5.oper.an.pl.128_060_pv.ll025sc.2010010100_2010010123.nc
[...]

Ralf Müller wrote in https://code.mpimet.mpg.de/boards/1/topics/3745?r=3749#message-3749:
---
There is a fundamental difference between netcdf and grib2

  • netcdf is a self-descibing file format
    • shortnames have to be uniq
    • your are free to define global of variable attributes
    • your are free to create any kind of dimensions
  • grib1 and grib2 are standards from the WMO
    • main purpose is having a global standard to be able to chare data worldwide - that's why
    • data parameters (names,units,..) are moreless FIXED:
    • information about these things is stored in text-tables coming with the reference implementation grib_api. You are free to add things in so called local tables for you own need, but you will not be able to chare these data sets with other grib2 users, because you table are let's-say private

HENCE: There is no general way to convert arbitrary netcdf files into grib2 format.

The CDO-Warning is about exactly this problem: the netcdf shortname is not part of the grib2 standard, so things cannot be converted out-of-the-box.
---
Nevertheless, the GRIB2 file should be generated and the GRIB-API error can be ignored. If the error message bothers you anyway then use NCO's ncks to delete the utc_date variable.

-Karin

Hi,
Thanks a lot for the detailed description.
If I do modifications to the tables, which table should I specifically look for, as there are many under the definitions directory?
I am trying to use the ERA5 data for WRF model for IC/BC. If possible could you suggest how I should proceed with the procedure for converting the files?

Best,
Neeldip

RE: netcdf to grib error - Added by Karin Meier-Fleischer over 4 years ago

I'm not a GRIB expert. Why do you want to convert netCDF back to GRIB? Usually it is done the way around.

RE: netcdf to grib error - Added by Neeldip Barman over 4 years ago

Karin Meier-Fleischer wrote:

I'm not a GRIB expert. Why do you want to convert netCDF back to GRIB? Usually it is done the way around.

The WRF Preprocessor known as the WPS, requires the meteorological data to be in GRIB1/2 format.

RE: netcdf to grib error - Added by Ralf Mueller over 4 years ago

If you really want to edit the tables manually, you should contact the WRF experts I think. this is too closely related to WRF to be completely solved by CDO.

Mostly you need to change netcdf shortnames to make them recognized by grib. I personally recommend not to edit the tables. But as they are just text files, you can to whatever you want with them.

cheers
ralf

RE: netcdf to grib error - Added by Neeldip Barman over 4 years ago

Thank you Karin and Ralf for your time and suggestions.

    (1-9/9)