mllam / neural-lam

Research Software for Neural Weather Prediction for Limited Area Modeling
https://join.slack.com/t/ml-lam/shared_invite/zt-2t112zvm8-Vt6aBvhX7nYa6Kbj_LkCBQ
MIT License
118 stars 48 forks source link

Output predictions as zarr dataset #89

Open khintz opened 1 day ago

khintz commented 1 day ago

When running evaluation mode figures are being created. Currently, there is no option to output the predictions. I would like to implement the option to output predictions as a Zarr dataset. (WIP: https://github.com/khintz/neural-lam/tree/feature/output).

This should be possible by converting the predictions tensor from the function test_step to a Zarr dataset.

    def test_step(self, batch, batch_idx):
        """
        Run test on single batch
        """
        prediction, target, pred_std, batch_times = self.common_step(batch)

This could be done by utilising the existing function create_dataarray_from_tensor https://github.com/mllam/neural-lam/blob/main/neural_lam/weather_dataset.py#L509 and then simply using xarray to output to zarr.

sadamov commented 1 day ago

This is a great idea. Some thoughts that come to mind:

So to summarize, this is clearly required. I suggest to make the output format flexible with sensible defaults. Also to adhere to pytorch's predict_... logic (maybe in a separate PR). And finally get rid of the two Draft PRs listed above.