Skip to content

Commit

Permalink
Merge pull request #285 from noisepy/carlosg/precommit_nb
Browse files Browse the repository at this point in the history
chore: Precommit check for notebook outputs
  • Loading branch information
mdenolle authored Jan 31, 2024
2 parents baae80e + 65ba350 commit 8185ca6
Show file tree
Hide file tree
Showing 11 changed files with 687 additions and 989 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/precommit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install pre-commit
run: pip install pre-commit==3.3.3
- name: Install pre-commit and Jupyter
run: pip install pre-commit==3.3.3 jupyter==1.0.0
- name: Run pre-commit checks
run: pre-commit run --all-files --show-diff-on-failure
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ repos:
exclude: \.ipy(n|nb)$
args: ["--autofix", "--indent=2", "--no-sort-keys"]

# Clear output from jupyter notebooks so that only the input cells are committed.
- repo: local
hooks:
- id: jupyter-nb-clear-output
name: Clear output from Jupyter notebooks
description: Clear output from Jupyter notebooks.
files: \.ipynb$
stages: [commit]
language: system
entry: jupyter nbconvert --clear-output

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
Expand Down
54 changes: 6 additions & 48 deletions script/write_speed/plot.ipynb

Large diffs are not rendered by default.

20 changes: 5 additions & 15 deletions tutorials/monitoring/attenuation_singlestation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@
"cell_type": "code",
"execution_count": null,
"id": "1a3ebcc4",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"# Ready to read in h5 file\n",
Expand Down Expand Up @@ -195,9 +193,7 @@
"cell_type": "code",
"execution_count": null,
"id": "50ace094",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"freq = [0.5, 1, 2,4] # targeted frequency band for waveform monitoring\n",
Expand Down Expand Up @@ -264,9 +260,7 @@
"cell_type": "code",
"execution_count": null,
"id": "d00a24e6",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"# get the mean-squared value on each componet and also the average waveform\n",
Expand Down Expand Up @@ -472,9 +466,7 @@
"cell_type": "code",
"execution_count": null,
"id": "c9d6f840",
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [],
"source": [
"# getting the sum of squared residuals (SSR) between Eobs and Esyn \n",
Expand Down Expand Up @@ -539,9 +531,7 @@
"cell_type": "code",
"execution_count": null,
"id": "beda26dc",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# getting the optimal value from the SSR\n",
Expand Down
150 changes: 17 additions & 133 deletions tutorials/noisepy_datastore.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions tutorials/noisepy_pnwstore_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "pWcrfWO8W1tH",
"scrolled": true
"id": "pWcrfWO8W1tH"
},
"outputs": [],
"source": [
Expand Down
Loading

0 comments on commit 8185ca6

Please sign in to comment.