• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 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 Ryan Keisler's 2022 "Forecasting Global Weather with Graph Neural Networks" paper (https://arxiv.org/abs/2202.07575)

Graph Weather

All Contributors

Implementation of the Graph Weather paper (https://arxiv.org/pdf/2202.07575.pdf) in PyTorch. Additionally, an implementation of a modified model that assimilates raw or processed observations into analysis files.

Installation

This library can be installed through

pip install graph-weather

Example Usage

The models generate the graphs internally, so the only thing that needs to be passed to the model is the node features in the same order as the lat_lons.

import torch
from graph_weather import GraphWeatherForecaster
from graph_weather.models.losses import NormalizedMSELoss

lat_lons = []
for lat in range(-90, 90, 1):
    for lon in range(0, 360, 1):
        lat_lons.append((lat, lon))
model = GraphWeatherForecaster(lat_lons)

features = torch.randn((2, len(lat_lons), 78))

out = model(features)
criterion = NormalizedMSELoss(lat_lons=lat_lons, feature_variance=torch.randn((78,)))
loss = criterion(out, features)
loss.backward()

And for the assimilation model, which assumes each lat/lon point also has a height above ground, and each observation is a single value + the relative time. The assimlation model also assumes the desired output grid is given to it as well.

import torch
from graph_weather import GraphWeatherAssimilator
from graph_weather.models.losses import NormalizedMSELoss

obs_lat_lons = []
for lat in range(-90, 90, 7):
    for lon in range(0, 180, 6):
        obs_lat_lons.append((lat, lon, np.random.random(1)))
    for lon in 360 * np.random.random(100):
        obs_lat_lons.append((lat, lon, np.random.random(1)))

output_lat_lons = []
for lat in range(-90, 90, 5):
    for lon in range(0, 360, 5):
        output_lat_lons.append((lat, lon))
model = GraphWeatherAssimilator(output_lat_lons=output_lat_lons, analysis_dim=24)

features = torch.randn((1, len(obs_lat_lons), 2))
lat_lon_heights = torch.tensor(obs_lat_lons)
out = model(features, lat_lon_heights)
assert not torch.isnan(out).all()
assert out.size() == (1, len(output_lat_lons), 24)

criterion = torch.nn.MSELoss()
loss = criterion(out, torch.randn((1, len(output_lat_lons), 24)))
loss.backward()

Pretrained Weights

Coming soon! We plan to train a model on GFS 0.25 degree operational forecasts, as well as MetOffice NWP forecasts. We also plan trying out adaptive meshes, and predicting future satellite imagery as well.

Training Data

Training data will be available through HuggingFace Datasets for the GFS forecasts. The initial set of data is available for GFSv16 forecasts, raw observations, and FNL Analysis files from 2016 to 2022, and for ERA5 Reanlaysis. MetOffice NWP forecasts we cannot redistribute, but can be accessed through CEDA.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Jacob Bieker
Jacob Bieker

πŸ’»
Jack Kelly
Jack Kelly

πŸ€”
byphilipp
byphilipp

πŸ€”
Markus Kaukonen
Markus Kaukonen

πŸ’¬
MoHawastaken
MoHawastaken

πŸ›
Mihai
Mihai

πŸ’¬
Vitus Benson
Vitus Benson

πŸ›
dongZheX
dongZheX

πŸ’¬
sabbir2331
sabbir2331

πŸ’¬

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

More Repositories

1

metnet

PyTorch Implementation of Google Research's MetNet and MetNet-2
Python
217
star
2

skillful_nowcasting

Implementation of DeepMind's Deep Generative Model of Radar (DGMR) https://arxiv.org/abs/2104.00954
Python
185
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