Skip to content

Decentralize EdgeModelOutputs and ExtendedLengyelOutputs to xarray conversion. - #2367

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_963991202
Open

Decentralize EdgeModelOutputs and ExtendedLengyelOutputs to xarray conversion.#2367
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_963991202

Conversation

@copybara-service

Copy link
Copy Markdown

Decentralize EdgeModelOutputs and ExtendedLengyelOutputs to xarray conversion.

Refactors edge model output serialization so that EdgeModelOutputs and
ExtendedLengyelOutputs manage their own output dictionary and DataTree
construction:

  • Adds EdgeModelOutputs.to_output_dict(context) and .to_xr_datatree(context).
  • Adds ExtendedLengyelOutputs.to_output_dict(context), ._process_roots_output(),
    and .to_xr_datatree(context).
  • Initializes self._output_grid_context on StateHistory to provide
    spatial/temporal coordinates for output conversion.
  • Simplifies StateHistory._save_edge_outputs() to delegate directly to
    self._stacked_edge_outputs.to_xr_datatree(self._output_grid_context).

This eliminates centralized, model-specific edge extraction logic in
output.py in accordance with TORAX design guidelines (avoiding God Objects
for I/O), making edge model serialization modular and polymorphic.

…nversion.

Refactors edge model output serialization so that EdgeModelOutputs and
ExtendedLengyelOutputs manage their own output dictionary and DataTree
construction:
- Adds EdgeModelOutputs.to_output_dict(context) and .to_xr_datatree(context).
- Adds ExtendedLengyelOutputs.to_output_dict(context), ._process_roots_output(),
  and .to_xr_datatree(context).
- Initializes self._output_grid_context on StateHistory to provide
  spatial/temporal coordinates for output conversion.
- Simplifies StateHistory._save_edge_outputs() to delegate directly to
  self._stacked_edge_outputs.to_xr_datatree(self._output_grid_context).

This eliminates centralized, model-specific edge extraction logic in
output.py in accordance with TORAX design guidelines (avoiding God Objects
for I/O), making edge model serialization modular and polymorphic.

PiperOrigin-RevId: 963991202
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant