Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
wesselb committed Jul 30, 2024
1 parent 355ea08 commit c7bce42
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
"""Copyright (c) Microsoft Corporation. Licensed under the MIT license."""

from datetime import datetime

import torch

from aurora import AuroraSmall, Batch, Metadata


def test_aurora_small():
model = AuroraSmall()

batch = Batch(
{k: torch.randn(1, 2, 16, 32) for k in ("2t", "10u", "10v", "msl")},
{k: torch.randn(1, 2, 16, 32) for k in ("lsm", "z", "slt")},
{k: torch.randn(1, 2, 4, 16, 32) for k in ("z", "u", "v", "t", "q")},
Metadata(
torch.linspace(90, -90, 17)[:-1], # Cut off the south pole.
torch.linspace(0, 360, 32 + 1)[:-1],
(datetime(2020, 6, 1, 12, 0),),
(100, 250, 500, 850),
),
)

pred = model.forward(batch)

assert isinstance(pred, Batch)

0 comments on commit c7bce42

Please sign in to comment.