• Stars
    star
    217
  • Rank 182,446 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 3 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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):

Jacob Bieker
Jacob Bieker

πŸ’»
Jack Kelly
Jack Kelly

πŸ’»
Valter Fallenius
Valter Fallenius

πŸ““
terigenbuaa
terigenbuaa

πŸ’¬
Kan.Dai
Kan.Dai

πŸ’¬
Sailesh Bechar
Sailesh Bechar

πŸ’¬

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

More Repositories

1

skillful_nowcasting

Implementation of DeepMind's Deep Generative Model of Radar (DGMR) https://arxiv.org/abs/2104.00954
Python
185
star
2

graph_weather

PyTorch implementation of Ryan Keisler's 2022 "Forecasting Global Weather with Graph Neural Networks" paper (https://arxiv.org/abs/2202.07575)
Python
162
star
3

quartz-frontend

Front End repo for the Nowcasting project.
TypeScript
94
star
4

satflow

Satellite Optical Flow with machine learning models
Python
58
star
5

predict_pv_yield

Using optical flow & machine learning to predict PV yield
Jupyter Notebook
51
star
6

Open-Source-Quartz-Solar-Forecast

Open Source Solar Site Level Forecast
Jupyter Notebook
50
star
7

Satip

Satip contains the code necessary for retrieving, transforming and storing EUMETSAT data
Jupyter Notebook
41
star
8

pvoutput

Python code for downloading PV data from PVOutput.org
Python
34
star
9

nowcasting_dataset

Prepare batches of data for training machine learning solar electricity nowcasting data
Jupyter Notebook
24
star
10

predict_pv_yield_OLD

Use machine learning to map from satellite imagery of clouds to solar PV yield
Jupyter Notebook
22
star
11

openclimatefix.github.io

HOSTING ONLY. SOURCE HERE --> https://github.com/openclimatefix/website
HTML
21
star
12

website

Source of the Open Climate Fix website.
JavaScript
14
star
13

satellite_image_processing

Jupyter Notebook
12
star
14

ocf_datapipes

OCF's DataPipe based dataloader for training and inference
Python
10
star
15

PVNet

PVnet main repo
Python
10
star
16

diffusion_weather

Testing out Diffusion-based models for weather and PV forecasting
Dockerfile
10
star
17

metoffice_ec2

Subset Met Office MOGREPS-UK and UKV on AWS EC2
Python
10
star
18

nwp

Tools for downloading and processing numerical weather predictions
Python
9
star
19

nwp-consumer

Microservice for consuming NWP data.
Python
9
star
20

pv-site-prediction

ML experiments and models for pv site forecasting
Python
8
star
21

nowcasting_dataloader

PyTorch Dataloader for working with multi-modal data for nowcasting applications
Jupyter Notebook
7
star
22

power_perceiver

Machine learning experiments using the Perceiver IO model to forecast the electricity system (starting with solar)
Jupyter Notebook
6
star
23

merge-all-contributors

Merge all contributors across a GitHub organisation.
JavaScript
6
star
24

metoffice_aws_lambda

AWS Lambda function for Met Office numerical weather predictions on S3
Python
6
star
25

nowcasting_datamodel

Datamodel for the nowcasting project
Python
6
star
26

climatehackai

Unified Repo for the models from the 2022 Climate Hack AI competition
Python
5
star
27

pv-site-api

Site specific API for PV forecasting
Python
5
star
28

eumetsat

Tools for downloading and processing satellite images from EUMETSAT
Jupyter Notebook
5
star
29

nowcasting_forecast

Making live forecasts for the nowcasting project
Python
5
star
30

uk-pv-national-gsp-api

API for hosting nowcasting solar predictions
Python
5
star
31

solar-and-storage

Solar and Storage optimization code
Python
5
star
32

uk-pv-national-xg

National PV forecasting using Gradient Boosted Methods.
Jupyter Notebook
4
star
33

ocf-ml-metrics

Collection of simple baseline models and metrics for standardized evaluation of OCF forecasting models
Python
4
star
34

pv-sites-mobile

Front End web application for site-level forecast UI
TypeScript
4
star
35

bigsolarhunt

The Big Solar Hunt Android/IOS app, a collaborative project between OCF and Possible.
Dart
4
star
36

Elexonpy

Python package wrapper around Elexon api
Python
4
star
37

ckanext-openenergy

Special customisations for the Energy Data Search.
Python
3
star
38

metrics

Toolkit to automatically collect OCF metrics and store them over time.
JavaScript
3
star
39

ocf-infrastructure

Infrastructure code for OCF's cloud environments
HCL
3
star
40

uk-wind-modelling-basic

Simple wind forecast repo
3
star
41

MetOfficeDataHub

Python wrapper around MetOffice Atmospheric Model Data REST API
Python
3
star
42

nowcasting_utils

Common functionality between SatFlow and predict_pv_yield
HTML
3
star
43

ocf_template

Template Repository for OCF Projects
Python
3
star
44

gfs-downloader

NCEP GFS 0.25 Degree Global Forecast Grids Historical Archive: https://rda.ucar.edu/datasets/ds084.1/
Python
3
star
45

pv-site-datamodel

Datamodel for PV sites
Python
2
star
46

gb_national_pv_forecast

Machine learning experiments for forecasting national solar PV for Great Britain
Jupyter Notebook
2
star
47

PVConsumer

Consumer PV data from various sources
Python
2
star
48

community

Community Repo for Open Climate Fix
2
star
49

predict_pv_yield_nwp

Python
2
star
50

dagster-dags

Dags for running jobs on Leonardo
Python
2
star
51

pv-pseudo-experiments

Repo containing the training and experimentation code for PV MetNet and Pseudo-Irradiance models
Python
2
star
52

ocf_blosc2

Blosc2 codec used for OCF's Zarr compression
Python
2
star
53

pv-site-production

Production service for PV site level forecasts
Python
1
star
54

analysis-dashboard

This is a Streamlit app for the OCF team that reports database statistics
Python
1
star
55

PVItaly

Forecast for PV energy systems
Python
1
star
56

india-forecast-app

Runs wind and PV forecasts for India and saves to database
Python
1
star
57

pseudo-labeller

Pseudo Labeller for generating training labels for other PV generation forecasting
Python
1
star
58

PV-Challenge

Python
1
star
59

JpegXlFloatWithNaNs

JpegXlFloatWithNaNs numcodecs compressor for usage with Zarr and Xarray
Python
1
star
60

contributors

Meta Repo for aggregating all contributors across Repos for OCF.
1
star
61

india-api

API India solar and wind data
Python
1
star
62

.github

Various Community Health Files
1
star
63

uk-pvnet-app

Application for running PVNet in production
Python
1
star
64

ocf-data-sampler

A test repo to experiment refactoring ocf_datapipes
Python
1
star
65

analysis_of_pv_live

Analysis of data from Sheffield Solar's PV_Live API
Jupyter Notebook
1
star