MetNet

A neural network that forecasts precipitation up to 8 hours into the future at the high spatial resolution of 1 km² and at the temporal resolution of 2 minutes with a latency in the order of second.
https://github.com/openclimatefix/metnet

Category: Atmosphere
Sub Category: Meteorological Observation and Forecast

Keywords

pytorch

Keywords from Contributors

nowcasting solar forecasting-models graph-neural-networks weather gan compression pytorch-lightning pytorch-implementation nowcasting-precipitation

Last synced: about 16 hours ago
JSON representation

Repository metadata

PyTorch Implementation of Google Research's MetNet and MetNet-2

README.md

MetNet and MetNet-2

All Contributors

PyTorch Implementation of Google Research's MetNet for short term weather forecasting (https://arxiv.org/abs/2003.12140), inspired from https://github.com/tcapelle/metnet_pytorch/tree/master/metnet_pytorch

MetNet-2 (https://arxiv.org/pdf/2111.07470.pdf) is a further extension of MetNet that takes in a larger context image to predict up to 12 hours ahead, and is also implemented in PyTorch here.

Installation

Clone the repository, then run

pip install -r requirements.txt
pip install -e .

Alternatively, you can also install a usually older version through pip install metnet

Please ensure that you're using Python version 3.9 or above.

Data

While the exact training data used for both MetNet and MetNet-2 haven't been released, the papers do go into some detail as to the inputs, which were GOES-16 and MRMS precipitation data, as well as the time period covered. We will be making those splits available, as well as a larger dataset that covers a longer time period, with HuggingFace Datasets! Note: The dataset is not available yet, we are still processing data!

from datasets import load_dataset

dataset = load_dataset("openclimatefix/goes-mrms")

This uses the publicly avaiilable GOES-16 data and the MRMS archive to create a similar set of data to train and test on, with various other splits available as well.

Pretrained Weights

Pretrained model weights for MetNet and MetNet-2 have not been publicly released, and there is some difficulty in reproducing their training. We release weights for both MetNet and MetNet-2 trained on cloud mask and satellite imagery data with the same parameters as detailed in the papers on HuggingFace Hub for MetNet and MetNet-2. These weights can be downloaded and used using:

from metnet import MetNet, MetNet2
model = MetNet().from_pretrained("openclimatefix/metnet")
model = MetNet2().from_pretrained("openclimatefix/metnet-2")

Example Usage

MetNet can be used with:

from metnet import MetNet
import torch
import torch.nn.functional as F

model = MetNet(
        hidden_dim=32,
        forecast_steps=24,
        input_channels=16,
        output_channels=12,
        sat_channels=12,
        input_size=32,
        )
# MetNet expects original HxW to be 4x the input size
x = torch.randn((2, 12, 16, 128, 128))
out = []
for lead_time in range(24):
        out.append(model(x, lead_time))
out = torch.stack(out, dim=1)
# MetNet creates predictions for the center 1/4th
y = torch.randn((2, 24, 12, 8, 8))
F.mse_loss(out, y).backward()

And MetNet-2 with:

from metnet import MetNet2
import torch
import torch.nn.functional as F

model = MetNet2(
        forecast_steps=8,
        input_size=64,
        num_input_timesteps=6,
        upsampler_channels=128,
        lstm_channels=32,
        encoder_channels=64,
        center_crop_size=16,
        )
# MetNet expects original HxW to be 4x the input size
x = torch.randn((2, 6, 12, 256, 256))
out = []
for lead_time in range(8):
        out.append(model(x, lead_time))
out = torch.stack(out, dim=1)
y = torch.rand((2,8,12,64,64))
F.mse_loss(out, y).backward()

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 8 days ago

Total Commits: 166
Total Committers: 9
Avg Commits per committer: 18.444
Development Distribution Score (DDS): 0.53

Commits in past year: 2
Committers in past year: 2
Avg Commits per committer in past year: 1.0
Development Distribution Score (DDS) in past year: 0.5

Name Email Commits
Jacob Bieker j****b@b****h 78
BumpVersion Action b****n@g****s 37
Raahul Singh r****2@g****m 19
allcontributors[bot] 4****] 14
pre-commit-ci[bot] 6****] 13
peterdudfield p****d@h****m 2
Rahul Maurya 9****b 1
Jack Kelly j****k@O****g 1
Database Missing no1 9****e 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 35
Total pull requests: 29
Average time to close issues: about 2 months
Average time to close pull requests: 27 days
Total issue authors: 20
Total pull request authors: 9
Average comments per issue: 3.51
Average comments per pull request: 1.17
Merged pull request: 24
Bot issues: 0
Bot pull requests: 12

Past year issues: 6
Past year pull requests: 1
Past year average time to close issues: N/A
Past year average time to close pull requests: 3 days
Past year issue authors: 6
Past year pull request authors: 1
Past year average comments per issue: 3.67
Past year average comments per pull request: 12.0
Past year merged pull request: 1
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/openclimatefix/metnet

Top Issue Authors

  • jacobbieker (10)
  • ValterFallenius (4)
  • peterdudfield (2)
  • JackKelly (2)
  • Raahul-Singh (2)
  • ShileiCao (1)
  • CUITCHENSIYU (1)
  • codeastra2 (1)
  • NMC-DAVE (1)
  • terigenbuaa (1)
  • vishalj0501 (1)
  • Nagessen (1)
  • lucasbs97 (1)
  • jramosss (1)
  • SaileshBechar (1)

Top Pull Request Authors

  • jacobbieker (11)
  • allcontributors[bot] (7)
  • pre-commit-ci[bot] (5)
  • peterdudfield (1)
  • ValterFallenius (1)
  • Averagenormaljoe (1)
  • JackKelly (1)
  • Raahul-Singh (1)
  • rahul-maurya11b (1)

Top Issue Labels

  • enhancement (15)
  • bug (10)
  • good first issue (4)
  • documentation (2)

Top Pull Request Labels

  • enhancement (7)

Package metadata

pypi.org: metnet

PyTorch MetNet Implementation

  • Homepage: https://github.com/openclimatefix/metnet
  • Documentation: https://metnet.readthedocs.io/
  • Licenses: MIT License
  • Latest release: 4.1.18 (published about 2 months ago)
  • Last Synced: 2025-05-15T23:03:02.738Z (1 day ago)
  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 629 Last month
  • Rankings:
    • Stargazers count: 5.689%
    • Forks count: 6.397%
    • Dependent packages count: 7.306%
    • Average: 8.335%
    • Downloads: 10.492%
    • Dependent repos count: 11.793%
  • Maintainers (2)

Dependencies

requirements.txt pypi
  • antialiased_cnns *
  • axial_attention *
  • einops >=0.3.0
  • huggingface_hub *
  • numpy >=1.19.5
  • pytorch_msssim *
  • torchvision >=0.10.0
.github/workflows/release.yaml actions
.github/workflows/workflows.yaml actions
setup.py pypi

Score: 14.3447884859858