Skip to content

Commit

Permalink
Merge branch 'main' into handle_cubelist
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylviabohnenstengel authored Jan 9, 2025
2 parents 9391a21 + 1530269 commit 82d007f
Show file tree
Hide file tree
Showing 51 changed files with 2,624 additions and 880 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/conda-lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
# Developer lock files.
cp "requirements/environment.yml" "${{ runner.temp }}/${py_ver}_dev_environment.yml"
echo -e "\n - python = $py_ver" >> "${{ runner.temp }}/${py_ver}_dev_environment.yml"
conda-lock --channel conda-forge --kind explicit --file "${{ runner.temp }}/${py_ver}_dev_environment.yml" --platform linux-64 --filename-template "requirements/locks/py$(echo $py_ver | sed 's/\.//')-lock-linux-64.txt" &
conda-lock --channel conda-forge --kind explicit --file "${{ runner.temp }}/${py_ver}_dev_environment.yml" --platform linux-64 --filename-template "requirements/locks/py$(echo $py_ver | sed 's/\.//')-lock-linux-64.txt"
# Workflow lock files.
cp "cset-workflow/requirements/environment.yml" "${{ runner.temp }}/${py_ver}_workflow_environment.yml"
echo -e "\n - python = $py_ver" >> "${{ runner.temp }}/${py_ver}_workflow_environment.yml"
conda-lock --channel conda-forge --kind explicit --file "${{ runner.temp }}/${py_ver}_workflow_environment.yml" --platform linux-64 --filename-template "cset-workflow/requirements/locks/py$(echo $py_ver | sed 's/\.//')-lock-linux-64.txt" &
conda-lock --channel conda-forge --kind explicit --file "${{ runner.temp }}/${py_ver}_workflow_environment.yml" --platform linux-64 --filename-template "cset-workflow/requirements/locks/py$(echo $py_ver | sed 's/\.//')-lock-linux-64.txt"
done
wait
Expand All @@ -66,28 +66,50 @@ jobs:
done
- name: Generate GitHub App Token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755
id: app-token
with:
app-id: ${{ secrets.AUTH_APP_ID }}
private-key: ${{ secrets.AUTH_APP_PRIVATE_KEY }}

- name: Create pull requests
env:
source_ref: ${{ github.ref }}
source_ref_type: ${{ github.ref_type }}
run: |
shopt -s globstar
# Display any changes in the log.
git diff --name-status
if $(sha256sum --status -c ${{ runner.temp }}/lock_file_hashes); then
# Exit early if there are no changes.
if $(sha256sum --status -c ${{ runner.temp }}/lock_file_hashes)
then
echo "Lock files unchanged. Skipping pull request..."
exit 0
fi
# Update lock_file_hashes so pushed branch name is unique.
sha256sum **/locks/*.txt > ${{ runner.temp }}/lock_file_hashes
# Commit changed lockfiles.
git add **/locks/*.txt
git commit -m "[CI] Update conda lock files"
# Update lock_file_hashes so pushed branch name is unique.
sha256sum **/locks/*.txt > ${{ runner.temp }}/lock_file_hashes
remote_branch_name="conda-lock-$(sha256sum ${{ runner.temp }}/lock_file_hashes | head -c 8)"
# If running from a branch target the created PR at that branch.
if [[ $source_ref_type = branch ]]
then
base_branch_name="$source_ref"
else
base_branch_name="main"
fi
# Push branch to GitHub.
git push --set-upstream origin "conda-lock-files:${remote_branch_name}"
# Create PR on GitHub using GitHub REST API.
request_body='{"title":"[CI] Update conda lock files","body":"Created automatically by GitHub Actions.","base":"main","head":"'"${remote_branch_name}"'"}'
request_body='{"title":"[CI] Update conda lock files","body":"Created automatically by GitHub Actions.","base":"'"${base_branch_name}"'","head":"'"${remote_branch_name}"'"}'
curl -LsS --fail-with-body \
-X POST \
-H "Accept: application/vnd.github+json" \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{hashFiles('requirements/locks/py312-lock-linux-64.txt')}}
path: |
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
sphinx-build -b html --color "docs/source" "docs/build/html"
echo '::endgroup::'
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: html-docs
path: docs/build/html/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
pre-commit autoupdate --freeze
- name: Generate GitHub App Token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755
id: app-token
with:
app-id: ${{ secrets.AUTH_APP_ID }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{ hashFiles(format('requirements/locks/{0}-lock-linux-64.txt', matrix.py-ver)) }}
path: |
Expand All @@ -44,11 +44,11 @@ jobs:
run: |
# Install package and run pytest.
echo '::group::Installing local package'
python3 -m pip install -e .
python3 -m pip install .
echo '::endgroup::'
pytest --verbose --cov --cov-append --cov-config=pyproject.toml
mv .coverage ".coverage.${{ matrix.py-ver }}"
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: coverage-data-${{ matrix.py-ver }}
path: .coverage.*
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: "3.x"
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: pre-commit|${{runner.os}}-${{runner.arch}}|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ~/.cache/pre-commit
Expand All @@ -123,7 +123,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{hashFiles('requirements/locks/py312-lock-linux-64.txt')}}
path: |
Expand All @@ -148,7 +148,7 @@ jobs:
sphinx-build -b html --color -W --keep-going "docs/source" "docs/build/html"
echo '::endgroup::'
- name: Upload documentation artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: html-docs
path: docs/build/html/
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build package
run: python3 -m build

- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: packages
path: dist/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weekly-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

- name: Cache conda environment
id: conda-env-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
key: conda|${{runner.os}}-${{runner.arch}}|${{hashFiles('requirements/locks/py312-lock-linux-64.txt')}}
path: |
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
echo '::group::Checking for broken hyperlinks'
sphinx-build -b linkcheck --color -W --keep-going "docs/source" "docs/build/linkcheck"
echo '::endgroup::'
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: html-docs
path: docs/build/html/
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 859e42ab7d54544f32d4f73bbc2136a7d9094f54 # frozen: v0.8.1
rev: 89c421dff2e1026ba12cdb9ebd731f4a83aa8021 # frozen: v0.8.6
hooks:
- id: ruff
args: [ --fix, --show-fixes, --exit-non-zero-on-fix ]
Expand Down
19 changes: 19 additions & 0 deletions cset-workflow/includes/aoa_diag.cylc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% if AOA_DIAG|default(False) %}
{% for model in models %}
{% for plev in AOA_PLEV %}
[runtime]
[[aoa_diag_m{{model["number"]}}_plev{{plev}}]]
inherit = PROCESS
execution time limit = PT60M

[[[directives]]]
--mem=12000
--ntasks=12

[[[environment]]]
CSET_RECIPE_NAME = "ageofair.yaml"
CSET_ADDOPTS = "--AOA_PLEV={{plev}} --AOA_CYCLIC={{AOA_CYCLIC}} --MODEL_NAME='{{model["name"]}}'"
MODEL_NUMBER = {{model["number"]}}
{% endfor %}
{% endfor %}
{% endif %}
2 changes: 2 additions & 0 deletions cset-workflow/includes/plot_spatial_plevel_model_field.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
[runtime]
[[generic_plevel_spatial_plot_sequence_m{{model_number}}_{{sanitise_task_name(field)}}_lv{{sanitise_task_name(plevel)}}]]
inherit = PROCESS
[[[directives]]]
--mem=4000
[[[environment]]]
CSET_RECIPE_NAME = "generic_plevel_spatial_plot_sequence.yaml"
CSET_ADDOPTS = """
Expand Down
42 changes: 42 additions & 0 deletions cset-workflow/meta/diagnostics/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,45 @@ help=Set to True if you want a one-to-one line; false if not.
type=python_boolean
compulsory=true
sort-key=qq1h

[template variables=AOA_DIAG]
ns=Diagnostics/Other
title=Run age of air diagnostic on specified pressure levels.
description=Run the age of air diagnostic on model data.
help=The age of air diagnostic provides a qualtitative view of how old air is within
the domain, by calculating a back trajectory at each grid point at each lead time
to determine when air entered through the lateral boundary. This is useful for
diagnosing how quickly air ventilates the domain, depending on its size and the
prevailing meteorology.
The diagnostic uses the u, v and w components of wind, along with geopotential height to
perform the back trajectory. Data is first regridded to 0.5 degrees.
Note: the code here does not consider sub-grid transport, and only uses the postprocessed
velocity fields and geopotential height. Its applicability is for large-scale flow O(1000 km),
and not small scale flow where mixing is likely to play a larger role.
type=python_boolean
compulsory=true
trigger=template variables=AOA_PLEV: True;
template variables=AOA_CYCLIC: True;
sort-key=aoa1

[template variables=AOA_PLEV]
ns=Diagnostics/Other
title=AOA: Pressure Levels
description=List of pressure levels to calculate the age of air diagnostic.
help=The pressure levels must be specified in hPa, where the variables (U,V,W,Z)
exist on the pressure level.
type=python_list
compulsory=true
sort-key=aoa2

[template variables=AOA_CYCLIC]
ns=Diagnostics/Other
title=AOA: Use Cyclic Option
description=If True, LAM is considered cyclic in the east/west direction.
help=This option when True, will allow back trajectories to advect through the east/
west boundary and continue through the other side of the domain. This is useful
for large domains such as the cyclic tropical channel, where there is no east/
west boundary.
type=python_boolean
compulsory=true
sort-key=aoa3
16 changes: 5 additions & 11 deletions cset-workflow/meta/rose-meta.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,12 @@ help=This is passed through to the plotting operators and sets the resolution
type=integer
compulsory=true

[template variables=WEB_DIR]
ns=General
description=Path to directory that is served by the webserver.
help=This will probably be under $HOME/public_html or similar. You will want to
ensure a subfolder is used as multiple files will be written here.
type=quoted
compulsory=true
sort-key=web2

[template variables=WEB_ADDR]
ns=General
title=Website address
description=The address at which the website is served.
description=The address at which the website is served. It should be specified
to the directory level above WEB_DIR (e.g.
https://example.com/~username if WEB_DIR is $HOME/public_html/CSET).
help=This should be the address where your public_html or equivalent is served.
It might include a partial path, such as your username.

Expand All @@ -74,7 +67,8 @@ sort-key=web1
[template variables=WEB_DIR]
ns=General
title=Web directory
description=Path to directory that is served by the webserver.
description=Path to directory that is served by the webserver
(e.g: $HOME/public_html/CSET).
help=This will probably be under $HOME/public_html or similar. You will want to
ensure a subfolder is used as it will be replaced with a symbolic link.

Expand Down
Loading

0 comments on commit 82d007f

Please sign in to comment.