Once a k_index has been created for the desired duration, you can use the DataTree model from the xarray-datatree library to view specific variables or the entire aggregation. This allows you to navigate the hierarchical structure of the aggregated GRIB data (e.g., by variable name, step type, or level).
# Example representation of a DataTree for GEFS model aggregation
DataTree('None', parent=None)
├── DataTree('prmsl')
│ │ Dimensions: ()
│ │ Data variables:
│ │ *empty*
│ │ Attributes:
│ │ name: Pressure reduced to MSL
│ └── DataTree('instant')
│ │ Dimensions: ()
│ │ Data variables:
│ │ *empty*
│ │ Attributes:
│ │ stepType: instant
│ └── DataTree('meanSea')
│ Dimensions: (latitude: 181, longitude: 360, time: 1, step: 1, model_horizons: 1, valid_times: 237)
│ Coordinates:
│ * latitude (latitude) float64 ...
│ * longitude (longitude) float64 ...
│ * meanSea float64 ...
│ * number (time, step) int64 ...
│ * step (model_horizons, valid_times) timedelta64[ns] ...
│ * time (model_horizons, valid_times) datetime64[ns] ...
│ * valid_time (model_horizons, valid_times) datetime64[ns] ...
│ Dimensions without coordinates: model_horizons, valid_times
│ Data variables:
│ prmsl (model_horizons, valid_times, latitude, longitude) float64 ...
│ Attributes:
│ typeOfLevel: meanSea
└── DataTree('ulwrf')
│ Dimensions: ()
│ Data variables:
│ *empty*
│ Attributes:
│ name: Upward long-wave radiation flux
└── DataTree('avg')
│ Dimensions: ()
│ Data variables:
│ *empty*
│ Attributes:
│ stepType: avg
└── DataTree('nominalTop')
Dimensions: (latitude: 181, longitude: 360, time: 1, step: 1, model_horizons: 1, valid_times: 237)
Coordinates:
* latitude (latitude) float64 ...
* longitude (longitude) float64 ...
* nominalTop float64 ...
* number (time, step) int64 ...
* step (model_horizons, valid_times) timedelta64[ns] ...
* time (model_horizons, valid_times) datetime64[ns] ...
* valid_time (model_horizons, valid_times) datetime64[ns] ...
Dimensions without coordinates: model_horizons, valid_times
Data variables:
ulwrf (model_horizons, valid_times, latitude, longitude) float64 ...
Attributes:
typeOfLevel: nominalTop