Graph Weather
Data-driven approach for forecasting global weather using graph neural network.
https://github.com/openclimatefix/graph_weather
Category: Atmosphere
Sub Category: Meteorological Observation and Forecast
Keywords
forecasting-models graph-neural-networks pytorch weather
Keywords from Contributors
gan pytorch-lightning nowcasting pvoutput solar pytorch-implementation eumetsat nowcasting-precipitation nowcasting-models simulator
Last synced: about 1 hour ago
JSON representation
Repository metadata
PyTorch implementation of Ryan Keisler's 2022 "Forecasting Global Weather with Graph Neural Networks" paper (https://arxiv.org/abs/2202.07575)
- Host: GitHub
- URL: https://github.com/openclimatefix/graph_weather
- Owner: openclimatefix
- License: mit
- Created: 2022-02-21T10:52:02.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-04-21T17:15:51.000Z (6 days ago)
- Last Synced: 2025-04-25T13:04:09.274Z (2 days ago)
- Topics: forecasting-models, graph-neural-networks, pytorch, weather
- Language: Python
- Homepage:
- Size: 5.47 MB
- Stars: 233
- Watchers: 4
- Forks: 64
- Open Issues: 67
- Releases: 115
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Graph Weather
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
Alternatively, you can install the latest version from the repository easily with pixi
:
pixi install # `-e cuda` for GPU support, `-e cpu` for CPU-only
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)
# Generate 78 random features + 24 non-NWP features (i.e. landsea mask)
features = torch.randn((2, len(lat_lons), 102))
target = torch.randn((2, len(lat_lons), 78))
out = model(features)
criterion = NormalizedMSELoss(lat_lons=lat_lons, feature_variance=torch.randn((78,)))
loss = criterion(out, target)
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
import numpy as np
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):
This project follows the all-contributors specification. Contributions of any kind welcome!
Owner metadata
- Name: Open Climate Fix
- Login: openclimatefix
- Email: [email protected]
- Kind: organization
- Description: Using open science to mitigate climate change
- Website: openclimatefix.org
- Location: London
- Twitter: openclimatefix
- Company:
- Icon url: https://avatars.githubusercontent.com/u/48357542?v=4
- Repositories: 88
- Last ynced at: 2024-04-15T07:32:15.529Z
- Profile URL: https://github.com/openclimatefix
GitHub Events
Total
- Create event: 19
- Release event: 17
- Issues event: 14
- Watch event: 40
- Issue comment event: 104
- Push event: 73
- Pull request review comment event: 94
- Pull request review event: 39
- Pull request event: 17
- Fork event: 16
Last Year
- Create event: 19
- Release event: 17
- Issues event: 14
- Watch event: 40
- Issue comment event: 104
- Push event: 73
- Pull request review comment event: 94
- Pull request review event: 39
- Pull request event: 17
- Fork event: 16
Committers metadata
Last synced: 4 days ago
Total Commits: 249
Total Committers: 14
Avg Commits per committer: 17.786
Development Distribution Score (DDS): 0.53
Commits in past year: 111
Committers in past year: 11
Avg Commits per committer in past year: 10.091
Development Distribution Score (DDS) in past year: 0.423
Name | Commits | |
---|---|---|
BumpVersion Action | b****n@g****s | 117 |
Jacob Bieker | j****b@b****h | 77 |
allcontributors[bot] | 4****] | 22 |
pre-commit-ci[bot] | 6****] | 9 |
gbruno16 | 7****6 | 7 |
Yuvraaj Narula | 4****a | 4 |
Lorenzo Breschi | 5****d | 4 |
Rahul Maurya | 9****b | 2 |
Aavash Subedi | 8****i | 2 |
peterdudfield | p****d@h****m | 1 |
assafshouval | a****l@g****m | 1 |
Vishal Gaur | 3****t | 1 |
Francesco | 3****a | 1 |
Aniket Shaha | 6****5 | 1 |
Committer domains:
- bieker.tech: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 82
Total pull requests: 69
Average time to close issues: 3 months
Average time to close pull requests: 23 days
Total issue authors: 22
Total pull request authors: 18
Average comments per issue: 3.43
Average comments per pull request: 0.9
Merged pull request: 54
Bot issues: 0
Bot pull requests: 23
Past year issues: 17
Past year pull requests: 31
Past year average time to close issues: 22 days
Past year average time to close pull requests: 21 days
Past year issue authors: 4
Past year pull request authors: 10
Past year average comments per issue: 3.88
Past year average comments per pull request: 1.35
Past year merged pull request: 22
Past year bot issues: 0
Past year bot pull requests: 6
Top Issue Authors
- jacobbieker (51)
- paapu88 (4)
- gbruno16 (3)
- byphilipp (2)
- vitusbenson (2)
- rahul-maurya11b (2)
- JackKelly (2)
- taeyoon91 (2)
- SauryChen (1)
- DarkSlice1 (1)
- marvingabler (1)
- ammoniaca (1)
- LinlinCui-NOAA (1)
- Esperanto-mega (1)
- SwordSaintLancelot (1)
Top Pull Request Authors
- allcontributors[bot] (12)
- pre-commit-ci[bot] (11)
- jacobbieker (9)
- yuvraajnarula (9)
- gbruno16 (8)
- rnwzd (4)
- aavashsubedi (3)
- rahul-maurya11b (3)
- FilippoContessa (1)
- assafshouval (1)
- mchantry (1)
- ACSE-vg822 (1)
- praj-tarun (1)
- branberry (1)
- SwordSaintLancelot (1)
Top Issue Labels
- enhancement (51)
- good first issue (21)
- bug (16)
- help wanted (4)
Top Pull Request Labels
- enhancement (4)
- documentation (1)
- size-big (1)
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 3,200 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 98
- Total maintainers: 2
pypi.org: graph-weather
Weather Forecasting with Graph Neural Networks
- Homepage: https://github.com/openclimatefix/graph_weather
- Documentation: https://graph-weather.readthedocs.io/
- Licenses: MIT License
- Latest release: 1.0.94 (published 3 months ago)
- Last Synced: 2025-04-26T13:37:12.346Z (1 day ago)
- Versions: 98
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 3,200 Last month
-
Rankings:
- Stargazers count: 6.814%
- Dependent packages count: 7.306%
- Forks count: 8.016%
- Average: 14.844%
- Dependent repos count: 22.077%
- Downloads: 30.008%
- Maintainers (2)
Dependencies
- datasets *
- einops *
- h3 *
- huggingface-hub *
- torch *
- torch-geometric *
- actions/checkout v2 composite
- actions/setup-python v2 composite
- codecov/codecov-action v2 composite
- ubuntu latest build
- datasets *
- einops *
- fsspec *
- huggingface-hub *
- pysolar *
- pytorch-lightning *
- torch-geometric-temporal *
Score: 16.414682953880618