{"id":13478300,"url":"https://github.com/openclimatefix/graph_weather","last_synced_at":"2026-01-02T11:57:05.780Z","repository":{"id":37819856,"uuid":"461818412","full_name":"openclimatefix/graph_weather","owner":"openclimatefix","description":"PyTorch implementation of Ryan Keisler's 2022 \"Forecasting Global Weather with Graph Neural Networks\" paper (https://arxiv.org/abs/2202.07575)","archived":false,"fork":false,"pushed_at":"2024-10-28T17:55:20.000Z","size":5678,"stargazers_count":192,"open_issues_count":55,"forks_count":50,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-10-29T21:01:43.969Z","etag":null,"topics":["forecasting-models","graph-neural-networks","pytorch","weather"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openclimatefix.png","metadata":{"funding":{"github":["openclimatefix"],"patreon":null,"open_collective":"openclimatefix","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-21T10:52:02.000Z","updated_at":"2024-10-23T15:27:25.000Z","dependencies_parsed_at":"2024-01-19T06:09:38.236Z","dependency_job_id":"80544e7c-4e47-4b7a-bbb6-48256bc5f6f8","html_url":"https://github.com/openclimatefix/graph_weather","commit_stats":{"total_commits":203,"total_committers":12,"mean_commits":"16.916666666666668","dds":0.5369458128078818,"last_synced_commit":"75760af284823906e535de53f03a79b0ddf3dc2b"},"previous_names":[],"tags_count":107,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fgraph_weather","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fgraph_weather/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fgraph_weather/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fgraph_weather/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openclimatefix","download_url":"https://codeload.github.com/openclimatefix/graph_weather/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280262,"owners_count":20912967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["forecasting-models","graph-neural-networks","pytorch","weather"],"created_at":"2024-07-31T16:01:55.219Z","updated_at":"2026-01-02T11:57:05.775Z","avatar_url":"https://github.com/openclimatefix.png","language":"Python","readme":"# Graph Weather\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThis repo implements graph neural networks for weather forecasting, originally an implementation of\nthe Graph Weather paper (https://arxiv.org/pdf/2202.07575.pdf) in PyTorch. Additionally, multiple other\nmodels have now been added, as well as general models for assimilation and forecasting.\n\nThe models implemented include:\n\nDeepMind's [Functional Generative Network (FGN)](https://storage.googleapis.com/deepmind-media/DeepMind.com/Blog/how-we-re-supporting-better-tropical-cyclone-prediction-with-ai/skillful-joint-probabilistic-weather-forecasting-from-marginals.pdf) for probablistic ensemble forecasting\n\nDeepMind's [GenCast](https://www.nature.com/articles/s41586-024-08252-9) for graph diffusion-based forecasting\n\nWindBorne's [WeatherMesh-3](https://arxiv.org/abs/2503.22235) for highly efficient forecasting with Neighborhood Attention\n\nMicrosoft's [Aurora](https://arxiv.org/abs/2405.13063) forecasting model\n\nAnd [FengWu-GHR](https://arxiv.org/abs/2402.00059) forecasting, using LoRA to correct for per-forecast step errors\n\nThe components of these models should be fairly modular and be able to be swapped around to experiment with graph-based weather forecasting.\n\n## Installation\n\nThis library can be installed through\n\n```bash\npip install graph-weather\n```\n\nAlternatively, you can install the latest version from the repository easily with `pixi`:\n\n```bash\npixi install # `-e cuda` for GPU support, `-e cpu` for CPU-only\n```\n\n## Example Usage\n\nThe models generate the graphs internally, so the only thing that needs to be passed to the model is the node features\nin the same order as the ```lat_lons```.\n\n```python\nimport torch\nfrom graph_weather import GraphWeatherForecaster\nfrom graph_weather.models.losses import NormalizedMSELoss\n\nlat_lons = []\nfor lat in range(-90, 90, 1):\n    for lon in range(0, 360, 1):\n        lat_lons.append((lat, lon))\nmodel = GraphWeatherForecaster(lat_lons)\n\n# Generate 78 random features + 24 non-NWP features (i.e. landsea mask)\nfeatures = torch.randn((2, len(lat_lons), 102))\n\ntarget = torch.randn((2, len(lat_lons), 78))\nout = model(features)\n\ncriterion = NormalizedMSELoss(lat_lons=lat_lons, feature_variance=torch.randn((78,)))\nloss = criterion(out, target)\nloss.backward()\n```\n\nAnd for the assimilation model, which assumes each lat/lon point also has a height above ground, and each observation\nis a single value + the relative time. The assimlation model also assumes the desired output grid is given to it as\nwell.\n\n```python\nimport torch\nimport numpy as np\nfrom graph_weather import GraphWeatherAssimilator\nfrom graph_weather.models.losses import NormalizedMSELoss\n\nobs_lat_lons = []\nfor lat in range(-90, 90, 7):\n    for lon in range(0, 180, 6):\n        obs_lat_lons.append((lat, lon, np.random.random(1)))\n    for lon in 360 * np.random.random(100):\n        obs_lat_lons.append((lat, lon, np.random.random(1)))\n\noutput_lat_lons = []\nfor lat in range(-90, 90, 5):\n    for lon in range(0, 360, 5):\n        output_lat_lons.append((lat, lon))\nmodel = GraphWeatherAssimilator(output_lat_lons=output_lat_lons, analysis_dim=24)\n\nfeatures = torch.randn((1, len(obs_lat_lons), 2))\nlat_lon_heights = torch.tensor(obs_lat_lons)\nout = model(features, lat_lon_heights)\nassert not torch.isnan(out).all()\nassert out.size() == (1, len(output_lat_lons), 24)\n\ncriterion = torch.nn.MSELoss()\nloss = criterion(out, torch.randn((1, len(output_lat_lons), 24)))\nloss.backward()\n```\n\n## Pretrained Weights\nComing soon! We plan to train a model on GFS 0.25 degree operational forecasts, as well as MetOffice NWP forecasts.\nWe also plan trying out adaptive meshes, and predicting future satellite imagery as well.\n\n## Training Data\nTraining 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](https://huggingface.co/datasets/openclimatefix/gfs-reforecast), and for [ERA5 Reanlaysis](https://huggingface.co/datasets/openclimatefix/era5-reanalysis). MetOffice NWP forecasts we cannot\nredistribute, but can be accessed through [CEDA](https://data.ceda.ac.uk/).\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://www.jacobbieker.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7170359?v=4?s=100\" width=\"100px;\" alt=\"Jacob Bieker\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJacob Bieker\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/graph_weather/commits?author=jacobbieker\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://jack-kelly.com\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/460756?v=4?s=100\" width=\"100px;\" alt=\"Jack Kelly\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJack Kelly\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-JackKelly\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/byphilipp\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/59995258?v=4?s=100\" width=\"100px;\" alt=\"byphilipp\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ebyphilipp\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-byphilipp\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://iki.fi/markus.kaukonen\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/6195764?v=4?s=100\" width=\"100px;\" alt=\"Markus Kaukonen\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMarkus Kaukonen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-paapu88\" title=\"Answering Questions\"\u003e💬\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/MoHawastaken\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/55447473?v=4?s=100\" width=\"100px;\" alt=\"MoHawastaken\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMoHawastaken\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/graph_weather/issues?q=author%3AMoHawastaken\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://www.ecmwf.int\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/47196359?v=4?s=100\" width=\"100px;\" alt=\"Mihai\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMihai\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-mishooax\" title=\"Answering Questions\"\u003e💬\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/vitusbenson\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/33334860?v=4?s=100\" width=\"100px;\" alt=\"Vitus Benson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eVitus Benson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/graph_weather/issues?q=author%3Avitusbenson\" title=\"Bug reports\"\u003e🐛\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/dongZheX\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/36361726?v=4?s=100\" width=\"100px;\" alt=\"dongZheX\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003edongZheX\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-dongZheX\" title=\"Answering Questions\"\u003e💬\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/sabbir2331\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/25061297?v=4?s=100\" width=\"100px;\" alt=\"sabbir2331\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003esabbir2331\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-sabbir2331\" title=\"Answering Questions\"\u003e💬\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/rnwzd\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/58804597?v=4?s=100\" width=\"100px;\" alt=\"Lorenzo Breschi\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLorenzo Breschi\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/graph_weather/commits?author=rnwzd\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/gbruno16\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/72879691?v=4?s=100\" width=\"100px;\" alt=\"gbruno16\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003egbruno16\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/graph_weather/commits?author=gbruno16\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","funding_links":["https://github.com/sponsors/openclimatefix","https://opencollective.com/openclimatefix"],"categories":["Python","Atmosphere"],"sub_categories":["Meteorological Observation and Forecast"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix%2Fgraph_weather","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenclimatefix%2Fgraph_weather","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix%2Fgraph_weather/lists"}