Differences in ERA5 Pressure Level Data Between CDS and CDS-Beta

Hi everyone,

I’m experiencing some discrepancies while downloading the ERA5 pressure level data using both the new and old licenses.

Here’s the code snippet I’m using:

import cdsapi
client = cdsapi.Client(url="url", key="secret-key")

dataset = 'reanalysis-era5-pressure-levels'
request =  {'product_type': 'reanalysis', 'format': 'netcdf', 'grid': ['0.25', '0.25'], 'date': ['2024-05-05'],
'time': ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17',
'18', '19', '20', '21', '22', '23'], 'variable': ['geopotential'], 'pressure_level': ['1']}
target = 'download_new.grib'

result = client.retrieve(dataset, request, target)

When I use the CDS API (old license) in the above code, the data I receive contains:

  • Variable: z (geopotential) only
  • Coordinates: longitude, latitude, time
  • Attributes: Conventions and history

However, when using the CDS-Beta API (new license) in the above code, the data output changes to:

  • Variables: number, expver, z (geopotential)
  • Coordinates: pressure_level, longitude, latitude, valid_time
  • More attributes, including: GRIB_centre, GRIB_centreDescription, GRIB_subCentre, Conventions, institution, history

I’m trying to understand how I can get the same output from the CDS-Beta that I currently get from the CDS. Any guidance or suggestions would be greatly appreciated!

Thank you in advance!

2 Likes

Same here.

I’ve been comparing some similar files using ncinfo, and it seems that the differences might be due to the conversion method from grib to netcdf. In the older CDS, the netcdf file was created using grib_to_netcdf-2.25.1, while in the newer CDS-Beta, it was created using cfgrib-0.9.14.0/ecCodes-2.36.0. This difference probably has led to discrepancies in the dimension names, variable names, and attributes within the files.

I used the nco and cdo commands to modify the new netcdf file (here, monthly mean zonal wind in 2023) to make it consistent with the old file as follows:

  1. $ ncrename -d pressure_level,level -v pressure_level,level -d date,time -v date,time u.mon.nc.2023
  2. $ ncatted -a long_name,level,o,c,“pressure_level” -a units,level,o,c,“millibars” -a stored_direction,level,d, u.mon.nc.2023
  3. $ ncpdq -a -level u.mon.nc.2023 u.mon.nc.2023.ncpdq
  4. $ cdo -setcalendar,“gregorian” -setreftime,‘1900-01-01’,‘00:00:00.0’,‘hours’ -settaxis,2023-01-01,00:00:00,1mo u.mon.nc.2023.ncpdq u.mon.nc.2023.ncpdq.setreftime
  5. $ cdo -P 8 -b F32 -f nc copy u.mon.nc.2023.ncpdq.setreftime u.mon.nc.2023.unpacked

First, I changed the dimension/variable names (in hourly data, the time axis was valid_time instead of date). Second, I modified attributes. Third, I reversed the vertical axis data. Then, I modified the time axis (in hourly data, the timestep is 1hour instead of 1mo) and unpacked the compressed netcdf file. I believe there may be many better ways than mine, but for my purpose, this method (though not perfect) worked to concatenate with my old netcdf files downloaded from CDS.

1 Like

I tried it and it worked. Thank you for sharing

1 Like