feat: Zarr export bridge for ensemble probabilistic forecasts#521
Open
Debadri-das wants to merge 4 commits intomllam:mainfrom
Open
feat: Zarr export bridge for ensemble probabilistic forecasts#521Debadri-das wants to merge 4 commits intomllam:mainfrom
Debadri-das wants to merge 4 commits intomllam:mainfrom
Conversation
- Support 4D tensors (S, T, N, F) for ensemble predictions - Add ensemble_member dimension to dims list - Implement ensemble_member coordinate binding logic - Maintain backward compatibility with 2D/3D tensors - Update docstring to document ensemble support Fixes mllam#520
- Update docstring to document 4D tensor support - Clarify parameter expectations for ensemble vs deterministic - Add Returns section with coordinate details - Enable Zarr export for probabilistic forecasts Refs mllam#520
- Test tensor with shape (S, T, N, F) where S=ensemble members - Verify ensemble_member coordinate exists and has correct size - Verify time coordinate is properly mapped - Verify all dimensions are correctly named - Ensure values are preserved in conversion Refs mllam#520
Document all changes related to issue mllam#520: - weather_dataset.py 4D tensor support with ensemble_member coordinate - ar_model.py ensemble prediction handling in _create_dataarray_from_tensor() - ar_model.py ensemble dimension stacking in unroll_prediction() - Test coverage for 4D ensemble DataArray creation Closes mllam#520
Author
|
Hi @joeloskarsson @sadamov , due to an ongoing nan bounds check issue, I am observing a local failure in test_clamping.py::test_clamping. Should we create a different issue to monitor it even if it has nothing to do with these DataArray modifications? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
This PR adds comprehensive support for 4D ensemble tensors
(S, T, N, F)to enable probabilistic weather forecast exports to Zarr format formllam-verificationintegration.Problem: Because the
neural-lamcodebase did not support 4D ensemble tensors and could only handle 2D/3D deterministic forecasts, probabilistic predictions could not be exported to Zarr format for external verification usingmllam-verification.Solution: Implemented full ensemble support across the data pipeline:
WeatherDataset (
neural_lam/weather_dataset.py):elif len(tensor.shape) == 4:branchensemble_memberdimension in dims list:["ensemble_member", "time", "grid_index", f"{category}_feature"]np.arange()ARModel Documentation (
neural_lam/models/ar_model.py):_create_dataarray_from_tensor()docstring with detailed ensemble support documentationARModel Ensemble Handling (
neural_lam/models/ar_model.py):unroll_prediction()to detect and handle 5D ensemble inputs (vs 4D deterministic)(B, S, T, N, F)→(B*S, T, N, F)(B*S, T, N, F)→(B, S, T, N, F)Test Coverage (
tests/test_datasets.py):test_dataset_item_create_dataarray_from_tensor_4d_ensemble()testDocumentation (
CHANGELOG.md):Motivation and Context
As stated in #62, the core evaluation pipeline is moving toward using
mllam-verification(supported by thescorespackage). We require a bridge to export ensemble predictions to Zarr in order to support probabilistic models (such as Graph-EFM). Ensemble forecasts cannot be used with external verification tools.Dependencies
No new dependencies are required. All code uses existing packages: PyTorch, xarray, and numpy.
Issue Link
#520
Type of change
Checklist before requesting a review
Commits
Related Issues
prob_model_lambranch #62 (evaluation pipeline migration to mllam-verification)