How do I interpret the Pressure values in this dataset? I downloaded ERA5 Potential Vorticity and Pressure(Monthly means of Daily means, analysis, Potential Temperature levels). The pressure data doesn’t make sense to me. Please see the attached image. The potential vorticity data makes sense. It is a 2D grid with the same shape as the lats/lons. But the pressure data is 1D with a length that doesn’t match anything I can think of. Any advice? Thanks!
Download request:
#!/usr/bin/env python
import cdsapi
c = cdsapi.Client()
c.retrieve("reanalysis-era5-complete", {
"class": "ea",
"date": "20200101/20200201/20200301/20200401/20200501/20200601/20200701/20200801/20200901/20201001/20201101/20201201/20210101/20210201/20210301/20210401/20210501/20210601/20210701/20210801/20210901/20211001/20211101/20211201/20220101/20220201/20220301/20220401/20220501/20220601/20220701/20220801/20220901/20221001/20221101/20221201/20230101/20230201/20230301/20230401/20230501/20230601/20230701/20230801/20230901/20231001/20231101/20231201/20240101/20240201/20240301/20240401/20240501/20240601/20240701/20240801",
"expver": "1",
"levelist": "265/275/285/300/315/320/330/350/370/395/430/475/530/600/700/850",
"levtype": "pt",
"param": "54.128/60.128",
"stream": "moda",
"type": "an"
}, "output")
So if you convert your grib file to netcdf like this
cdo -f nc4 copy test.grb test.nc4
and look at the header with ncdump
ncdump -h test.nc4
you will see that the PV field (var60) is retrieved on an unstructured reduced Gaussian grid and the pressure field (var54) is a spectral field, that's why you have the zeros as these are the spectral coefficients.
float var54(time, lev, nsp, nc2) ;
var54:table = 128 ;
var54:CDI_grid_type = "spectral" ;
var54:axis = "TZ--" ;
var54:truncation = 639 ;
float var60(time, lev, rgrid) ;
var60:table = 128 ;
var60:CDI_grid_type = "gaussian_reduced" ;
var60:CDI_grid_num_LPE = 320 ;
var60:CDI_grid_latitudes = "lat" ;
var60:CDI_grid_reduced_points = "reduced_points" ;
This makes conversion to a regular grid problematic with cdo
, you can do this with eccodes
though.
However, a far easier solution is to simply request a regular lat-lon grid in the original retrieval, and let MARS handle the interpolation for you. You can do this with the keyword "grid", like this (I also use the format
keyword to get the file directly as netcdf, but of course you can stay with grib if you prefer).
#!/usr/bin/env python
import cdsapi
c = cdsapi.Client()
c.retrieve("reanalysis-era5-complete", {
"class": "ea",
"date": "20200101",
"expver": "1",
"levelist": "265/275/285/300/315/320/330/350/370/395/430/475/530/600/700/850",
"levtype": "pt",
"param": "54.128/60.128",
"stream": "moda",
"type": "an",
"grid": "F128",
"format":"netcdf"
}, "test2.nc")
This retrieves the data directly on a regular lat-lon grid.
My test2.nc file now has these dimensions:
longitude = 512 ;
latitude = 256 ;
theta = 16 ;
And here are my regular-gridded field headers for the two variables:
float pres(theta, latitude, longitude)
float pv(theta, latitude, longitude)
I used a low resolution 128 grid here, but you can select others. See the WIKI for the grid options.