diff --git a/pycontrails/datalib/ecmwf/era5.py b/pycontrails/datalib/ecmwf/era5.py index 3b08091b..3a00ab84 100644 --- a/pycontrails/datalib/ecmwf/era5.py +++ b/pycontrails/datalib/ecmwf/era5.py @@ -539,9 +539,9 @@ def _preprocess_era5_dataset(self, ds: xr.Dataset) -> xr.Dataset: LOG.debug("Input dataset processed with pycontrails > 0.29") return ds - # For "reanalysis-era5-single-levels" or if self.pressure_levels length == 1, + # For "reanalysis-era5-single-levels" # then the netcdf file does not contain the dimension "level" - if len(self.pressure_levels) == 1: + if self.is_single_level: ds = ds.expand_dims(level=self.pressure_levels) # New CDS-Beta gives "valid_time" instead of "time"