prithvi-wxc

Implementation of the Prithvi WxC Foundation Model and Downstream Tasks

https://github.com/nasa-impact/prithvi-wxc

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Implementation of the Prithvi WxC Foundation Model and Downstream Tasks

Basic Info
  • Host: GitHub
  • Owner: NASA-IMPACT
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 65.4 MB
Statistics
  • Stars: 150
  • Watchers: 6
  • Forks: 35
  • Open Issues: 10
  • Releases: 2
Created almost 2 years ago · Last pushed 11 months ago
Metadata Files
Readme License

README.md

Prithvi WxC: Foundation model for weather and climate

This repository contains the code of the Prithvi WxC foundation model as well as basic zero-shot examples for testing and illustration. For fine-tuning applications please refer to task-specific repositories listed below.

Updates

March 25, 2025

The previous version of this repo contained a number of bugs that led to incorrect model outputs and worse performance than in our paper. We just addressed these issues. In particular, there is validation code below that lets you verify whether your particular platform and version of the code obtains results comparable to ours. (See step 3 under Getting started.)

Architecture overview: A scalable and flexible vision transformer

Prithvi WxC is at its core a scalable 2D vision transformer. The architecture is designed to allow for memory-efficient masked pretraining. It draws inspiration from both Hiera, MaxViT and SWIN transformers. Inputs, structured into windows, take the shape (batch, windows, tokens, features). We alternate between local attention (within a window) and global attention (across windows). This is implemented by transposing dimensions between transformer layers. Attention acts on the third dimension, the second being part of the batch. When data becomes dense -- i.e. in the absence of masking -- it is possible to add SWIN-like shifts to the local attention layers. See the figure for illustration:

arch_main

Fine-tuning applications

We have fine-tuned the model to a number of downstream tasks. See the paper as well as the respective repository for details.

| Application | Dataset | Repository | | ---------------------------- | ----------- | ---------------------------------- | | Downscaling | MERRA-2 | https://github.com/IBM/granite-wxc | | Downscaling | EURO-CORDEX | https://github.com/IBM/granite-wxc | | Gravity wave parametrization | ERA5 | https://github.com/NASA-IMPACT/gravity-wave-finetuning |

Beyond these there are zero-shot applications in masked reconstruction and forecasting.

Getting started

  1. Create a virtual environment
  2. Clone this repository and install Prithvi WxC as a module git clone https://github.com/NASA-IMPACT/Prithvi-WxC cd Prithvi-WxC pip install '.[examples]'
  3. Validate that the model behaves as expected. For that run python -m validation.validate_prithvi_wxc -c validation/config.yaml
  4. Run one of the notebooks in the examples directory:

These notebooks will download model weights as well as sample data for basic illustration from Hugging Face.

Pretrained models

Prithvi WxC is a very flexible model. It has been pretrained on a pretext task blending masked reconstruction and forecasting so that it can be used for both zero-hours ahead as well as forecasting applications. Moreover, the masking pattern makes it suitable for both global and regional applications. There are currently two pretrained base models as well as several fine-tuning applications.

| Model | Details | Weights | | ---------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | | prithvi.wxc.2300m.v1 | Pretrained 2.3B parameter model. Flexible input and lead time. For general and 0-hour ahead applications. | https://huggingface.co/Prithvi-WxC/prithvi.wxc.2300m.v1 | | prithvi.wxc.rollout.2300m.v1 | Pretrained 2.3B parameter model. Input and lead time fixed to 6h. For forecasting applications. | https://huggingface.co/Prithvi-WxC/prithvi.wxc.rollout.2300m.v1 |

Data

Prithvi WxC used data from the MERRA-2 reanalysis for pretraining. In particular, the model uses a climatology computed from MERRA-2 data. The climatology, too, is available via Hugging Face. See the paper for details on variables choosen and the methodology behind the climatology.

Citation

If you use this work, consider citing our paper

@misc{schmude2024prithviwxcfoundationmodel, title={Prithvi WxC: Foundation Model for Weather and Climate}, author={Johannes Schmude and Sujit Roy and Will Trojak and Johannes Jakubik and Daniel Salles Civitarese and Shraddha Singh and Julian Kuehnert and Kumar Ankur and Aman Gupta and Christopher E Phillips and Romeo Kienzler and Daniela Szwarcman and Vishal Gaur and Rajat Shinde and Rohit Lal and Arlindo Da Silva and Jorge Luis Guevara Diaz and Anne Jones and Simon Pfreundschuh and Amy Lin and Aditi Sheshadri and Udaysankar Nair and Valentine Anantharaj and Hendrik Hamann and Campbell Watson and Manil Maskey and Tsengdar J Lee and Juan Bernabe Moreno and Rahul Ramachandran}, year={2024}, eprint={2409.13598}, archivePrefix={arXiv}, primaryClass={cs.LG}, url={https://arxiv.org/abs/2409.13598}, }

Owner

  • Name: Inter Agency Implementation and Advanced Concepts
  • Login: NASA-IMPACT
  • Kind: organization
  • Email: esds.dsig@gmail.com

GitHub Events

Total
  • Create event: 8
  • Release event: 3
  • Issues event: 16
  • Watch event: 52
  • Delete event: 5
  • Member event: 1
  • Issue comment event: 10
  • Push event: 15
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 23
  • Fork event: 20
Last Year
  • Create event: 8
  • Release event: 3
  • Issues event: 16
  • Watch event: 52
  • Delete event: 5
  • Member event: 1
  • Issue comment event: 10
  • Push event: 15
  • Pull request review comment event: 2
  • Pull request review event: 6
  • Pull request event: 23
  • Fork event: 20

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 88
  • Total Committers: 8
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.534
Past Year
  • Commits: 88
  • Committers: 8
  • Avg Commits per committer: 11.0
  • Development Distribution Score (DDS): 0.534
Top Committers
Name Email Commits
Johannes Schmude J****e@i****m 41
Will Trojak w****k@i****m 22
Romeo Kienzler r****1@i****m 10
Lelouch vi' Britania s****4@h****m 7
Daniel Salles Civitarese 1****e 5
lino 4****i 1
Julian Kuehnert J****u 1
Johannes Jakubik 1****1 1
Committer Domains (Top 20 + Academic)
ibm.com: 3

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 13
  • Total pull requests: 42
  • Average time to close issues: 11 days
  • Average time to close pull requests: about 13 hours
  • Total issue authors: 9
  • Total pull request authors: 10
  • Average comments per issue: 0.69
  • Average comments per pull request: 0.29
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 13
  • Pull requests: 42
  • Average time to close issues: 11 days
  • Average time to close pull requests: about 13 hours
  • Issue authors: 9
  • Pull request authors: 10
  • Average comments per issue: 0.69
  • Average comments per pull request: 0.29
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • WillTrojak (5)
  • ShileiCao (2)
  • rubencart (1)
  • taylorfturner (1)
  • gajeshladhar (1)
  • sdash77 (1)
  • dun280 (1)
  • whpy (1)
  • seangtkelley (1)
Pull Request Authors
  • WillTrojak (23)
  • dancivitarese (6)
  • romeokienzler (6)
  • johannesschmude (5)
  • jhnnsjkbk1 (2)
  • michelebanfi (2)
  • simonpf (2)
  • take2rohit (2)
  • Jubeku (1)
  • eloisabentivegna (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Dependencies

docs/requirements.txt pypi
  • Sphinx >=8.0.2
  • graphviz *
  • mkdocs *
  • pytools >=2016.2.1
  • sphinx-rtd-theme *
  • sphinxcontrib-napoleon *
pyproject.toml pypi
  • h5py ~= 3.3
  • numpy ~= 1.26
  • pandas ~= 2.2
  • torch >= 2.2