Skip to content

Commit

Permalink
renaming of files, clarification of dev env with precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
TeaganKing committed Oct 21, 2024
1 parent 4aa0ad2 commit 9f9b15b
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 15 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you do not have `mamba` installed, you can still use `conda`... it will just
$ pip install -e . # installs cupid
```

1. Run `pre-commit install` to configure `git` to automatically run `pre-commit` checks when you try to commit changes; the commit will only proceed if all checks pass. Note that CUPiD uses `pre-commit` to ensure code formatting guidelines are followed, and pull requests will not be accepted if they fail the `pre-commit`-based Github Action.
1. In the `cupid-dev` environment, run `pre-commit install` to configure `git` to automatically run `pre-commit` checks when you try to commit changes from the `cupid-dev` environment; the commit will only proceed if all checks pass. Note that CUPiD uses `pre-commit` to ensure code formatting guidelines are followed, and pull requests will not be accepted if they fail the `pre-commit`-based Github Action.
1. If you plan on contributing code to CUPiD,
whether developing CUPiD itself or providing notebooks for CUPiD to run,
please see the [Contributor's Guide](https://ncar.github.io/CUPiD/ContributorsGuide.html).
Expand Down
2 changes: 1 addition & 1 deletion docs/Contributors_Guide.md → docs/ContributorsGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In order to contribute code to this repository, we recommend that you get starte
4. [Install CUPiD](https://ncar.github.io/CUPiD/index.html#installing), relevant environments, and setup `pre-commit`.
5. Make your edits and add your name to our `contributors.md` file to make sure we recognize your contributions
6. Merge in recent changes from master
7. Ensure that `pre-commit` checks all pass
7. Ensure that `pre-commit` checks all pass from the `cupid-dev` environment
8. IF updating `github.io` pages, test with the steps listed below, otherwise proceed to #9:
- Create the environment necessary for building documentation with `$ conda env create -f environments/docs.yml`
- Activate the docs environment: `$ conda activate cupid-docs`
Expand Down
2 changes: 0 additions & 2 deletions docs/NCARtips.rst

This file was deleted.

4 changes: 2 additions & 2 deletions docs/addingnotebookstocollection.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ Generally, a good fit for a diagnostic notebook is one that reads in CESM output

7. Update your parameters. Parameters that are specific to just this notebook should go under `parameter_groups` in the notebook's entry under `compute_notebooks`. Global parameters that you want passed in to every notebook in the collection should go under `global_params`. When `CUPiD` executes your notebook, all of these parameters will get put in a new cell below the cell tagged `parameters` that you added in step 3. This means they will supercede the values of the parameters that you put in the cell above---the names, notation, etc. should match to make sure your notebook is able to find the variables it needs.

8. Your collection can now be run and built with `cupid-run` and `cupid-build` as usual.
8. Your collection can now be run with `cupid-run`, and then the website can be built with `cupid-build`.

9. If you're happy with your notebook and want to add it to the CUPiD repository, there are a few formatting items that we would like contributors to follow:
* Title your notebook something descriptive. A recommended format is `<region>_<variable>_<metric>_<comparisons>.ipynb`; for instance, this might look like `Global_PSL_NMSE_compare_obs_lens.ipynb` or `Greenland_SMB_visual_compare_obs.ipynb`.
* Add a [cell tag](https://jupyterbook.org/en/stable/content/metadata.html#jupyter-cell-tags) `hide-input` for cells which output plots, and add the tag `hide-cell` for cells that do not contain plots (this will hide both the input and output). Do this through JupyterHub when editing your notebook: click `View --> Cell Toolbar --> Tags` and add either `hide-input` or `hide-cell`. This makes it easier to glance at the plots once the webpage is built and not need to scroll through code cells.
* Set up `pre-commit` to ensure that your code is properly formatted and linted. Running `pre-commit install` will configure `git` to automatically run the `pre-commit` checks when you try to commit changes; the commit will only proceed if all the checks pass.
* Set up `pre-commit` in the `cupid-dev` environment to ensure that your code is properly formatted and linted. Running `pre-commit install` will configure `git` to automatically run the `pre-commit` checks when you try to commit changes; the commit will only proceed if all the checks pass.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

print("sys.path:", sys.path)

# Copy README, NCAR_tips, and contributors, and Contributors_Guide into docs
# Copy README, NCAR_tips, and Contributors into docs
# This block allows us to remove the header image from any md files
# without affecting the original version, but still pull the source
# into the docs build fresh each time.

for file in ["README.md", "NCAR_tips.md", "contributors.md", "Contributors_Guide.md"]:
for file in ["README.md", "NCARtips.md", "Contributors.md"]:
os.system(f"cp ../{file} ./")

# Remove any images from the first line of the file
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/contributors_to_cupid.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.. include:: contributors.md
.. include:: Contributors.md
:parser: myst
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ CUPiD Documentation
:maxdepth: 2
:hidden:

Contributor's Guide <ContributorsGuide.rst>
Contributor's Guide <contributors_guide.rst>
Adding Notebooks <addingnotebookstocollection.md>
Configuration File <config.md>
Tips and Tricks for NCAR Machines <NCARtips.rst>
Tips and Tricks for NCAR Machines <ncar_tips.rst>
Contributors <contributors_to_cupid.rst>

.. include:: README.md
Expand Down
2 changes: 2 additions & 0 deletions docs/ncar_tips.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. include:: NCARtips.md
:parser: myst
8 changes: 4 additions & 4 deletions examples/key_metrics/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ compute_notebooks:
none: {}

atm:
nmse_PSL:
Global_PSL_NMSE_compare_obs_lens:
parameter_groups:
none:
regridded_output: False # it looks like output is already on f09 grid, didn't need to regrid time-series file
base_regridded_output: True
validation_path: '/glade/campaign/cesm/development/cross-wg/diagnostic_framework/nmse_validation/fv0.9x1.25'

glc:
LIWG_SMB_diagnostic:
Greenland_SMB_visual_compare_obs:
parameter_groups:
none:
obs_path: '/glade/u/home/gunterl/obs_diagnostic_cesm/'
Expand Down Expand Up @@ -191,7 +191,7 @@ book_toc:

- caption: Atmosphere
chapters:
- file: atm/nmse_PSL
- file: atm/Global_PSL_NMSE_compare_obs_lens

# - caption: Ocean
# chapters:
Expand All @@ -207,7 +207,7 @@ book_toc:

- caption: Land Ice
chapters:
- file: glc/LIWG_SMB_diagnostic
- file: glc/Greenland_SMB_visual_compare_obs

#####################################
# Keys for Jupyter Book _config.yml #
Expand Down
File renamed without changes.

0 comments on commit 9f9b15b

Please sign in to comment.