ERA5 hourly data netcdf variable dimension order

Hi,

Are the dimensions guaranteed to always be in the same order in the ERA5 hourly data on pressure levels and ERA5 hourly data on single levels?

I can solve the problem by adding code which gets the dimensions of each variable, checks the presence of pertinent values, then constructs the extraction of data ordering the values used in the slicing of the data table depending on this result but it is a bit of a cumbersome tasks and is useless if the variables are always in the same order.

Here is an example of code to read a dataset and extract temperature values for all pressure levels for the first date, the first latitude and first longitude:

import netCDF4 as nc
ds=nc.Dataset('data.nc')
t=ds['t']
temperature=t[0,:,0,0]
print(temperature)

This code presumes that the dimensions of the t variable are : (‘valid_time’, ‘pressure_level’, ‘latitude’, ‘longitude’). But if this order changes it breaks. If there is no reason for the order to change then it’s perfect.

Thanks!