|
1 | 1 | Working branch for demonstrating CMIP7 CVs access via esgvoc. |
2 | 2 | Not meant for widespread consumption. |
3 | 3 | This README will be re-written if/when this branch is merged back into main. |
| 4 | + |
| 5 | +## CMOR CVs file |
| 6 | + |
| 7 | +When using [cmor](https://github.com/PCMDI/cmor) for re-writing raw model output, |
| 8 | +a JSON file of controlled vocabulary (CV) information is required. |
| 9 | +A JSON file in the required format, based on the CVs information contained in this repository |
| 10 | +is included here, see `cmor-cvs.json`. |
| 11 | + |
| 12 | +### Keeping the file up to date |
| 13 | + |
| 14 | +To ensure that this file is always consistent with the CV content, |
| 15 | +we check it as part of each pull request. |
| 16 | +Pull requests are only merged into the `esgvoc` branch once the CMOR CVs file is up to date. |
| 17 | + |
| 18 | +The process for updating the CMOR CVs file can be a bit fiddly, |
| 19 | +as it requires carefully installing and using `esgvoc`. |
| 20 | +To make updating the file simpler, we have introduced some extra functionality. |
| 21 | +In a pull request, you can simply comment |
| 22 | +`\update-cmor-cvs-table` and the CMOR CVs file will be updated. |
| 23 | + |
| 24 | +In most cases, simply commenting `\update-cmor-cvs-table` will be enough. |
| 25 | +In such a case, the content of the `cmor-cvs-creation.env` file |
| 26 | +is used to determine which fork and branch/commit of the CMIP7 CVs, |
| 27 | +the universe CVs and esgvoc to use when updating the CVs file. |
| 28 | +In some cases, you will want to update these settings. |
| 29 | +This can be done by parsing arguments to the `\update-cmor-cvs-table` command, |
| 30 | +e.g. `\update-cmor-cvs-table universe-cvs-fork="my-fork" esgvoc-commit="abc123"`. |
| 31 | +At the time of writing, the available arguments are |
| 32 | +(check the github workflow file for the full list of available arguments): |
| 33 | + |
| 34 | +- `universe-cvs-fork`: The fork to use when retrieving the universe CVs |
| 35 | +- `universe-cvs-brach`: The branch to use when retrieving the universe CVs |
| 36 | +- `esgvoc-fork`: The fork to use when installing esgvoc |
| 37 | +- `esgvoc-commit`: The commit (ID) to use when installing esgvoc |
| 38 | +- `cmip7-cvs-fork`: The fork to use when retrieving the CMIP7 CVs |
| 39 | +- `cmip7-cvs-branch`: 'The branch to use when retrieving the CMIP7 CVs |
| 40 | + |
| 41 | +For users who prefer to run things locally, simply update `cmor-cvs-creation.env` as required, |
| 42 | +then run `bash install-environment-for-cmor-cvs-creation.sh -v` |
| 43 | +then `esgvoc cmor-export-cvs-table --out-path cmor-cvs.json` |
| 44 | +then finally commit and push the result. |
| 45 | + |
| 46 | +#### Developer notes |
| 47 | + |
| 48 | +The set of actions which makes this possible is relatively straightforward. |
| 49 | +In short, there is one workflow that listens for comments |
| 50 | +(`slash-command-dispatch.yaml` at the time of writing) |
| 51 | +and one that updates the file |
| 52 | +(`update-cmor-cvs-table-command.yaml` at the time of writing). |
| 53 | +If a comment of the right form is made, then the workflow that updates the file is run. |
| 54 | +The actions that are used for this are all clearly specified in the relevant workflow files. |
| 55 | + |
| 56 | +The other key component is authentication. |
| 57 | +In order for the action to be able to commit and push, |
| 58 | +there is a secret `PERSONAL_ACCESS_TOKEN`, which contains an access token |
| 59 | +that gives the required permissions. |
0 commit comments