{"id":13570295,"url":"https://github.com/openclimatefix/metnet","last_synced_at":"2025-04-04T22:02:44.263Z","repository":{"id":43144395,"uuid":"402393162","full_name":"openclimatefix/metnet","owner":"openclimatefix","description":"PyTorch Implementation of Google Research's MetNet and MetNet-2","archived":false,"fork":false,"pushed_at":"2024-04-08T17:52:11.000Z","size":193,"stargazers_count":217,"open_issues_count":27,"forks_count":46,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-04-14T11:50:43.060Z","etag":null,"topics":["pytorch"],"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}},"created_at":"2021-09-02T11:20:11.000Z","updated_at":"2024-04-15T18:51:33.725Z","dependencies_parsed_at":"2023-12-03T17:03:10.290Z","dependency_job_id":"a0ec6505-ff9c-41bc-b63e-fdb5600149a3","html_url":"https://github.com/openclimatefix/metnet","commit_stats":{"total_commits":164,"total_committers":8,"mean_commits":20.5,"dds":0.524390243902439,"last_synced_commit":"00eb017686a8a37162ac46bfa7f0611405d51c04"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fmetnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fmetnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fmetnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclimatefix%2Fmetnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openclimatefix","download_url":"https://codeload.github.com/openclimatefix/metnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244489171,"owners_count":20460948,"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":["pytorch"],"created_at":"2024-08-01T14:00:50.649Z","updated_at":"2025-03-28T21:07:47.110Z","avatar_url":"https://github.com/openclimatefix.png","language":"Python","funding_links":["https://github.com/sponsors/openclimatefix","https://opencollective.com/openclimatefix"],"categories":["Uncategorized","Atmosphere"],"sub_categories":["Uncategorized","Meteorological Observation and Forecast"],"readme":"# MetNet and MetNet-2\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nPyTorch 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\n\nMetNet-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.\n\n## Installation\n\nClone the repository, then run\n```shell\npip install -r requirements.txt\npip install -e .\n````\n\nAlternatively, you can also install a usually older version through ```pip install metnet```\n\nPlease ensure that you're using Python version 3.9 or above.\n\n## Data\n\nWhile 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](https://huggingface.co/datasets/openclimatefix/goes-mrms)! Note: The dataset is not available yet, we are still processing data!\n\n```python\nfrom datasets import load_dataset\n\ndataset = load_dataset(\"openclimatefix/goes-mrms\")\n```\n\nThis 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.\n\n## Pretrained Weights\nPretrained 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](https://huggingface.co/openclimatefix/metnet) and [MetNet-2](https://huggingface.co/openclimatefix/metnet-2). These weights can be downloaded and used using:\n\n```python\nfrom metnet import MetNet, MetNet2\nmodel = MetNet().from_pretrained(\"openclimatefix/metnet\")\nmodel = MetNet2().from_pretrained(\"openclimatefix/metnet-2\")\n```\n\n## Example Usage\n\nMetNet can be used with:\n\n```python\nfrom metnet import MetNet\nimport torch\nimport torch.nn.functional as F\n\nmodel = MetNet(\n        hidden_dim=32,\n        forecast_steps=24,\n        input_channels=16,\n        output_channels=12,\n        sat_channels=12,\n        input_size=32,\n        )\n# MetNet expects original HxW to be 4x the input size\nx = torch.randn((2, 12, 16, 128, 128))\nout = []\nfor lead_time in range(24):\n        out.append(model(x, lead_time))\nout = torch.stack(out, dim=1)\n# MetNet creates predictions for the center 1/4th\ny = torch.randn((2, 24, 12, 8, 8))\nF.mse_loss(out, y).backward()\n```\n\nAnd MetNet-2 with:\n\n```python\nfrom metnet import MetNet2\nimport torch\nimport torch.nn.functional as F\n\nmodel = MetNet2(\n        forecast_steps=8,\n        input_size=64,\n        num_input_timesteps=6,\n        upsampler_channels=128,\n        lstm_channels=32,\n        encoder_channels=64,\n        center_crop_size=16,\n        )\n# MetNet expects original HxW to be 4x the input size\nx = torch.randn((2, 6, 12, 256, 256))\nout = []\nfor lead_time in range(8):\n        out.append(model(x, lead_time))\nout = torch.stack(out, dim=1)\ny = torch.rand((2,8,12,64,64))\nF.mse_loss(out, y).backward()\n```\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/metnet/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=\"https://github.com/openclimatefix/metnet/commits?author=JackKelly\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/ValterFallenius\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/21970939?v=4?s=100\" width=\"100px;\" alt=\"Valter Fallenius\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eValter Fallenius\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#userTesting-ValterFallenius\" title=\"User Testing\"\u003e📓\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/terigenbuaa\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/91317406?v=4?s=100\" width=\"100px;\" alt=\"terigenbuaa\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eterigenbuaa\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-terigenbuaa\" 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/NMC-DAVE\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/26354668?v=4?s=100\" width=\"100px;\" alt=\"Kan.Dai\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eKan.Dai\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-NMC-DAVE\" 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/SaileshBechar\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/38445041?v=4?s=100\" width=\"100px;\" alt=\"Sailesh Bechar\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSailesh Bechar\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#question-SaileshBechar\" 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/rahul-maurya11b\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/98907006?v=4?s=100\" width=\"100px;\" alt=\"Rahul Maurya\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRahul Maurya\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/openclimatefix/metnet/commits?author=rahul-maurya11b\" title=\"Tests\"\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix%2Fmetnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenclimatefix%2Fmetnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclimatefix%2Fmetnet/lists"}