Skip to content

Commit f133547

Browse files
committed
squash linear history
1 parent a1036b4 commit f133547

File tree

277 files changed

+23229
-2229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

277 files changed

+23229
-2229
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ Changes:
55
- Can group multiple related symbols on a single bullet
66

77
- [ ] Tests added
8+
- [ ] If dependencies changed, "deps only" image rebuilt and "latest_deps_only_image.txt" file updated
89

910
Resolves #<github issues> (delete if none)

.github/workflows/docs.yaml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,21 @@ on:
88
branches:
99
- main
1010

11+
# Add a button to manually trigger the workflow
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: "pages"
24+
cancel-in-progress: false
25+
1126
jobs:
1227
build:
1328
runs-on: ubuntu-latest
@@ -22,19 +37,27 @@ jobs:
2237
- uses: actions/cache@v4
2338
with:
2439
path: ${{ env.pythonLocation }}
25-
key: v1-${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('docs/requirements.txt') }}-${{ hashFiles('constraints.txt') }}
40+
key: v1-${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('docs/requirements.txt') }}-${{ hashFiles('requirements-healpix.txt') }}-${{ hashFiles('constraints.txt') }}
2641
- name: Install dependencies
2742
run: |
2843
python -m pip install uv
29-
uv pip install --system -c constraints.txt -e .[docs]
44+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
45+
uv venv --python 3.11
46+
uv pip install -c constraints.txt -e .[docs]
47+
uv pip install --no-build-isolation -c constraints.txt -e .[docs,healpix]
3048
- name: Build docs
3149
run: |
50+
source .venv/bin/activate
3251
cd docs && make doctest html
33-
- name: Deploy to GitHub Pages
34-
uses: peaceiris/actions-gh-pages@v3
35-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
52+
- name: Upload to GitHub Pages
53+
uses: actions/upload-pages-artifact@v3
3654
with:
37-
publish_branch: gh-pages
38-
github_token: ${{ secrets.GITHUB_TOKEN }}
39-
publish_dir: docs/_build/
40-
force_orphan: true
55+
path: docs/_build/html
56+
deploy:
57+
runs-on: ubuntu-latest
58+
# Only deploy on manual trigger or push to main
59+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
60+
needs: build
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
uses: actions/deploy-pages@v4

.github/workflows/tests.yaml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,19 @@ jobs:
2222
- uses: actions/cache@v4
2323
with:
2424
path: ${{ env.pythonLocation }}
25-
key: v1-${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}-${{ hashFiles('constraints.txt') }}
25+
key: v1-${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}-${{ hashFiles('requirements-healpix.txt') }}-${{ hashFiles('constraints.txt') }}
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install uv
29-
uv pip install --system -c constraints.txt -e .[dev]
29+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
30+
uv venv --python 3.11
31+
uv pip install -c constraints.txt -e .[dev]
32+
uv pip install --no-build-isolation -c constraints.txt -e .[dev,healpix]
3033
- name: Run pytest with code coverage
3134
run: |
35+
source .venv/bin/activate
3236
make test_cov
33-
cpu-very-fast:
37+
cpu-very-fast-no-healpix:
3438
runs-on: ubuntu-latest
3539
steps:
3640
- uses: actions/checkout@v3
@@ -51,3 +55,35 @@ jobs:
5155
- name: Run pytest
5256
run: |
5357
make test_very_fast
58+
gpu:
59+
# These steps run on our self-hosted k8s GPU runners. See below for setup notes
60+
# https://github.com/ai2cm/long-lived-infrastructure#installing-the-github-actions-runner-controller
61+
runs-on: arc-runner-set
62+
steps:
63+
- uses: actions/checkout@v3
64+
- name: Set environment variables
65+
run: |
66+
echo "CURRENT_WEEK=$(date +'%Y-%U')" >> $GITHUB_ENV
67+
- uses: actions/setup-python@v4
68+
with:
69+
python-version: "3.11"
70+
- uses: actions/cache@v4
71+
with:
72+
path: ${{ env.pythonLocation }}
73+
key: ${{ env.CURRENT_WEEK }}-${{ env.pythonLocation }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}-${{ hashFiles('requirements-healpix.txt') }}-${{ hashFiles('constraints.txt') }}
74+
- name: Install dependencies
75+
run: |
76+
sudo apt-get update
77+
sudo apt-get install -y make git build-essential
78+
python -m pip install uv
79+
# can't use --system here because it doesn't work with --no-build-isolation and a healpix dependency
80+
uv venv --python 3.11
81+
uv pip install -c constraints.txt -e .[dev]
82+
uv pip install --no-build-isolation -c constraints.txt -e .[dev,healpix]
83+
- name: Run CUDA check and pytest
84+
run: |
85+
source .venv/bin/activate
86+
export PATH=/usr/local/nvidia/bin:${PATH}
87+
export LD_LIBRARY_PATH=/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}
88+
python3 fme/require_gpu.py
89+
make test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
docs/available_modules.rst
2+
docs/available_steps.rst
23
docs/_build
4+
filtered_repo/
5+
files_excluded_by_filter.txt
36

47
.vscode
58

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repos:
1010
hooks:
1111
- id: check-added-large-files
1212
args: [--maxkb=250]
13+
exclude: |
14+
(?x)^(
15+
fme/ace/aggregator/inference/testdata/.*-regression.pt
16+
)$
1317
- id: trailing-whitespace
1418
- id: file-contents-sorter
1519
files: |
@@ -28,4 +32,5 @@ repos:
2832
(?x)^(
2933
.+/conf.py |
3034
.+/conftest.py |
35+
fme/ace/models/makani_fcn3/.*
3136
)$

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
VERSION ?= $(shell git rev-parse --short HEAD)
22
IMAGE ?= fme
3+
REGISTRY ?= registry.nersc.gov/m4492/ai2cm
34
ENVIRONMENT_NAME ?= fme
5+
USERNAME ?= $(shell beaker account whoami --format=json | jq -r '.[0].name')
46
DEPLOY_TARGET ?= pypi
7+
BEAKER_WORKSPACE = ai2/ace
58

69
ifeq ($(shell uname), Linux)
710
CONDA_PACKAGES=gxx_linux-64 pip
@@ -12,15 +15,36 @@ endif
1215
build_docker_image:
1316
DOCKER_BUILDKIT=1 docker build --platform=linux/amd64 -f docker/Dockerfile -t $(IMAGE):$(VERSION) --target production .
1417

18+
push_shifter_image: build_docker_image
19+
docker tag $(IMAGE):$(VERSION) $(REGISTRY)/$(IMAGE):$(VERSION)
20+
docker push $(REGISTRY)/$(IMAGE):$(VERSION)
21+
22+
build_beaker_image: build_docker_image
23+
beaker image create --name $(IMAGE)-$(VERSION) $(IMAGE):$(VERSION)
24+
25+
build_podman_image:
26+
podman-hpc build -f docker/Dockerfile -t $(IMAGE):$(VERSION) .
27+
28+
migrate_podman_image: build_podman_image
29+
podman-hpc migrate $(IMAGE):$(VERSION)
30+
1531
enter_docker_image: build_docker_image
1632
docker run -it --rm $(IMAGE):$(VERSION) bash
1733

34+
launch_beaker_session:
35+
./launch-beaker-session.sh $(USERNAME)/$(IMAGE)-$(VERSION)
36+
37+
build_deps_only_image:
38+
DOCKER_BUILDKIT=1 docker build --platform=linux/amd64 -f docker/Dockerfile -t $(IMAGE)-deps-only:$(VERSION) --target deps-only .
39+
beaker image create $(IMAGE)-deps-only:$(VERSION) --name $(IMAGE)-deps-only-$(VERSION) --workspace ai2/ace-ci-tests
40+
1841

1942
# recommended to deactivate current conda environment before running this
2043
create_environment:
2144
conda create -n $(ENVIRONMENT_NAME) python=3.11 $(CONDA_PACKAGES)
2245
conda run --no-capture-output -n $(ENVIRONMENT_NAME) python -m pip install uv
2346
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install -c constraints.txt -e .[dev,docs]
47+
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install --no-build-isolation -c constraints.txt -r requirements-healpix.txt
2448
conda run --no-capture-output -n $(ENVIRONMENT_NAME) uv pip install -r analysis-deps.txt
2549

2650
test:

PACKAGE_README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[![Docs](https://readthedocs.org/projects/ai2-climate-emulator/badge/?version=latest)](https://ai2-climate-emulator.readthedocs.io/en/latest/)
2-
[![PyPI](https://img.shields.io/pypi/v/fme.svg)](https://pypi.org/project/fme/)
32

43
# FME: Weather/Climate Model Emulation
5-
This package contains code to train and evaluate weather/climate model emulators.
4+
This package contains code to train and evaluate weather/climate model emulators as seen in
5+
"ACE: A fast, skillful learned global atmospheric model for climate prediction" ([arxiv:2310.02074](https://arxiv.org/abs/2310.02074))
6+
and "Application of the Ai2 Climate Emulator to E3SMv2's global atmosphere model, with a focus on precipitation fidelity"
7+
([JGR-ML](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2024JH000136)).
8+
69

710
## Installation
811

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ This repo contains code accompanying five papers describing ACE models:
1111
- "ACE: A fast, skillful learned global atmospheric model for climate prediction" ([link](https://arxiv.org/abs/2310.02074))
1212
- "Application of the Ai2 Climate Emulator to E3SMv2's global atmosphere model, with a focus on precipitation fidelity" ([link](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2024JH000136))
1313
- "ACE2: Accurately learning subseasonal to decadal atmospheric variability and forced responses" ([link](https://www.nature.com/articles/s41612-025-01090-0))
14-
- "ACE2-SOM: Coupling to a slab ocean and learning the sensitivity of climate to changes in CO2" ([link](https://arxiv.org/abs/2412.04418))
15-
- "Applying the ACE2 Emulator to SST Green's Functions for the E3SMv3 Global Atmosphere Model" ([link](https://arxiv.org/abs/2505.08742))
14+
- "ACE2-SOM: Coupling an ML Atmospheric Emulator to a Slab Ocean and Learning the Sensitivity of Climate to Changed CO<sub>2</sub>" ([link](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2024JH000575))
15+
- "Applying the ACE2 Emulator to SST Green's Functions for the E3SMv3 Global Atmosphere Model" ([link](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2025JH000774))
1616

1717
## Installation
1818

@@ -26,4 +26,25 @@ See complete documentation [here](https://ai2-climate-emulator.readthedocs.io/en
2626

2727
## Model checkpoints
2828

29-
Pretrained model checkpoints, and datasets to run them, are available in the [ACE Hugging Face](https://huggingface.co/collections/allenai/ace-67327d822f0f0d8e0e5e6ca4) collection.
29+
Pretrained model checkpoints are available in the [ACE Hugging Face](https://huggingface.co/collections/allenai/ace-67327d822f0f0d8e0e5e6ca4) collection.
30+
31+
## Available datasets
32+
Two versions of the complete dataset described in [arxiv:2310.02074](https://arxiv.org/abs/2310.02074)
33+
are available on a [requester pays](https://cloud.google.com/storage/docs/requester-pays) Google Cloud Storage bucket:
34+
```
35+
gs://ai2cm-public-requester-pays/2023-11-29-ai2-climate-emulator-v1/data/repeating-climSST-1deg-zarrs
36+
gs://ai2cm-public-requester-pays/2023-11-29-ai2-climate-emulator-v1/data/repeating-climSST-1deg-netCDFs
37+
```
38+
The `zarr` format is convenient for ad-hoc analysis. The netCDF version contains our
39+
train/validation split which was used for training and inference.
40+
41+
The datasets used in the [ACE2 paper](https://arxiv.org/abs/2411.11268) are available at:
42+
```
43+
gs://ai2cm-public-requester-pays/2024-11-13-ai2-climate-emulator-v2-amip/data/c96-1deg-shield/
44+
gs://ai2cm-public-requester-pays/2024-11-13-ai2-climate-emulator-v2-amip/data/era5-1deg-1940-2022.zarr/
45+
```
46+
47+
The dataset used in the [ACE2-SOM paper](https://arxiv.org/abs/2412.04418) is available at:
48+
```
49+
gs://ai2cm-public-requester-pays/2024-12-05-ai2-climate-emulator-v2-som/SHiELD-SOM-C96
50+
```

analysis-deps.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# these are convenient to have installed for ad-hoc analysis but are not requirements of the "fme" package
22
Bottleneck
3+
beaker-gantry==3.*
4+
beaker-py
35
bokeh>=3.1.0
46
dask[distributed]
57
ipywidgets

docker/Dockerfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ ENV FORCE_CUDA_EXTENSION=1
2121
# install python deps
2222
COPY requirements.txt /tmp/requirements.txt
2323
RUN python3 -m pip install -r /tmp/requirements.txt
24+
COPY requirements-healpix.txt /tmp/requirements-healpix.txt
25+
RUN python3 -m pip install --no-build-isolation -r /tmp/requirements-healpix.txt
2426

2527
FROM base AS production
2628

@@ -29,4 +31,22 @@ COPY . ${FME_DIR}
2931
RUN cd $FME_DIR && pip install --no-deps -e .
3032

3133
# copy after install so editing scripts does not trigger reinstall
32-
COPY scripts ${FME_DIR}/scripts
34+
COPY scripts ${FME_DIR}/scripts
35+
36+
FROM base AS deps-only
37+
38+
# install github cli and yq
39+
RUN apt-get update && apt-get install -y \
40+
ca-certificates \
41+
&& curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
42+
&& echo "deb [signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
43+
&& apt-get update && apt-get install -y gh \
44+
&& apt-get clean \
45+
&& rm -rf /var/lib/apt/lists/*
46+
47+
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\
48+
chmod +x /usr/bin/yq
49+
50+
COPY scripts/ci_beaker/entrypoint.sh /entrypoint.sh
51+
RUN chmod +x /entrypoint.sh
52+
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)