Skip to content

Commit 97cba05

Browse files
thodson-usgsclaude
andcommitted
chore(pre-commit): add nbstripout to strip notebook outputs on commit
Stacks on #293 (which switched pre-commit to ruff-only and cleaned the text-file housekeeping). The one piece #293 didn't cover is the checked-in notebook outputs — they balloon the demo notebook diffs on every re-run with timestamps, quota counters, and HTML/plot blobs, even when the source cells are unchanged. Adds the kynan/nbstripout pre-commit hook (rev 0.8.1) and runs it once across the existing tree, stripping cell outputs + execution_count from the 15 checked-in waterdata notebooks. Demos still execute cleanly locally; commits now diff the source rather than the rendered run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f7960c2 commit 97cba05

17 files changed

Lines changed: 597 additions & 251 deletions

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ repos:
2626
- id: ruff-check
2727
args: [--fix]
2828
- id: ruff-format
29+
30+
# Strip cell outputs + execution_count from notebooks on commit so the
31+
# diff is the source, not the rendered run. Demos still execute fine
32+
# locally; clean commits keep PRs reviewable and avoid quota/timestamp
33+
# churn on every re-run.
34+
- repo: https://github.com/kynan/nbstripout
35+
rev: 0.8.1
36+
hooks:
37+
- id: nbstripout

demos/USGS_WaterData_ContinuousData_Examples.ipynb

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "d664492b",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Continuous Data\n",
@@ -21,7 +21,7 @@
2121
{
2222
"cell_type": "code",
2323
"execution_count": null,
24-
"id": "e7e06e81",
24+
"id": "1",
2525
"metadata": {},
2626
"outputs": [],
2727
"source": [
@@ -34,7 +34,7 @@
3434
},
3535
{
3636
"cell_type": "markdown",
37-
"id": "b0136bd1",
37+
"id": "2",
3838
"metadata": {},
3939
"source": [
4040
"## What continuous data are available?\n",
@@ -46,7 +46,7 @@
4646
{
4747
"cell_type": "code",
4848
"execution_count": null,
49-
"id": "6f8a9d87",
49+
"id": "3",
5050
"metadata": {},
5151
"outputs": [],
5252
"source": [
@@ -60,7 +60,7 @@
6060
},
6161
{
6262
"cell_type": "markdown",
63-
"id": "fdaa8150",
63+
"id": "4",
6464
"metadata": {},
6565
"source": [
6666
"## Large requests are chunked for you\n",
@@ -79,7 +79,7 @@
7979
{
8080
"cell_type": "code",
8181
"execution_count": null,
82-
"id": "6bc05102",
82+
"id": "5",
8383
"metadata": {},
8484
"outputs": [],
8585
"source": [
@@ -93,7 +93,7 @@
9393
},
9494
{
9595
"cell_type": "markdown",
96-
"id": "353ad4ec",
96+
"id": "6",
9797
"metadata": {},
9898
"source": [
9999
"## Resilient pulls: resume after an interruption\n",
@@ -119,7 +119,7 @@
119119
{
120120
"cell_type": "code",
121121
"execution_count": null,
122-
"id": "e2e9ddff",
122+
"id": "7",
123123
"metadata": {},
124124
"outputs": [],
125125
"source": [
@@ -151,7 +151,7 @@
151151
},
152152
{
153153
"cell_type": "markdown",
154-
"id": "397e87b5",
154+
"id": "8",
155155
"metadata": {},
156156
"source": [
157157
"## The 3-year window: the one axis you split yourself\n",
@@ -170,7 +170,7 @@
170170
{
171171
"cell_type": "code",
172172
"execution_count": null,
173-
"id": "bd26d199",
173+
"id": "9",
174174
"metadata": {},
175175
"outputs": [],
176176
"source": [
@@ -191,7 +191,7 @@
191191
},
192192
{
193193
"cell_type": "markdown",
194-
"id": "3bc4f40f",
194+
"id": "10",
195195
"metadata": {},
196196
"source": [
197197
"Then request each window and concatenate. (We use a short two-window span here so\n",
@@ -201,7 +201,7 @@
201201
{
202202
"cell_type": "code",
203203
"execution_count": null,
204-
"id": "01ebb4a0",
204+
"id": "11",
205205
"metadata": {},
206206
"outputs": [],
207207
"source": [
@@ -225,7 +225,7 @@
225225
},
226226
{
227227
"cell_type": "markdown",
228-
"id": "e2487bf4",
228+
"id": "12",
229229
"metadata": {},
230230
"source": [
231231
"Wrap each window's call in the resume pattern above for an unattended,\n",

demos/USGS_WaterData_DailyStatistics_Examples.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "fe73969b",
5+
"id": "0",
66
"metadata": {},
77
"source": [
88
"# Daily statistics: `get_stats_por` and `get_stats_date_range`\n",
@@ -29,7 +29,7 @@
2929
{
3030
"cell_type": "code",
3131
"execution_count": null,
32-
"id": "d6ab1ce4",
32+
"id": "1",
3333
"metadata": {},
3434
"outputs": [],
3535
"source": [
@@ -46,7 +46,7 @@
4646
},
4747
{
4848
"cell_type": "markdown",
49-
"id": "cf8868ae",
49+
"id": "2",
5050
"metadata": {},
5151
"source": [
5252
"## Fetching day-of-year and month-of-year statistics\n",
@@ -61,7 +61,7 @@
6161
{
6262
"cell_type": "code",
6363
"execution_count": null,
64-
"id": "f0ab13bb",
64+
"id": "3",
6565
"metadata": {},
6666
"outputs": [],
6767
"source": [
@@ -77,7 +77,7 @@
7777
},
7878
{
7979
"cell_type": "markdown",
80-
"id": "3dc2b04f",
80+
"id": "4",
8181
"metadata": {},
8282
"source": [
8383
"The first two rows are the day-of-year averages. What's the third row? Its\n",
@@ -93,7 +93,7 @@
9393
{
9494
"cell_type": "code",
9595
"execution_count": null,
96-
"id": "4d561aba",
96+
"id": "5",
9797
"metadata": {},
9898
"outputs": [],
9999
"source": [
@@ -103,7 +103,7 @@
103103
},
104104
{
105105
"cell_type": "markdown",
106-
"id": "43fe1eef",
106+
"id": "6",
107107
"metadata": {},
108108
"source": [
109109
"### Percentile band plot\n",
@@ -121,7 +121,7 @@
121121
{
122122
"cell_type": "code",
123123
"execution_count": null,
124-
"id": "18bd842c",
124+
"id": "7",
125125
"metadata": {},
126126
"outputs": [],
127127
"source": [
@@ -142,7 +142,7 @@
142142
},
143143
{
144144
"cell_type": "markdown",
145-
"id": "c8fc4a28",
145+
"id": "8",
146146
"metadata": {},
147147
"source": [
148148
"Pivoting the day-of-year rows so each percentile is a column lets us draw the\n",
@@ -152,7 +152,7 @@
152152
{
153153
"cell_type": "code",
154154
"execution_count": null,
155-
"id": "aaa72823",
155+
"id": "9",
156156
"metadata": {},
157157
"outputs": [],
158158
"source": [
@@ -193,7 +193,7 @@
193193
},
194194
{
195195
"cell_type": "markdown",
196-
"id": "7b4075bd",
196+
"id": "10",
197197
"metadata": {},
198198
"source": [
199199
"Finally, overlay the actual daily mean discharge so we can see where recent\n",
@@ -205,7 +205,7 @@
205205
{
206206
"cell_type": "code",
207207
"execution_count": null,
208-
"id": "961eea3a",
208+
"id": "11",
209209
"metadata": {},
210210
"outputs": [],
211211
"source": [
@@ -241,7 +241,7 @@
241241
},
242242
{
243243
"cell_type": "markdown",
244-
"id": "e31f1726",
244+
"id": "12",
245245
"metadata": {},
246246
"source": [
247247
"## Fetching monthly and annual statistics within a date range\n",
@@ -254,7 +254,7 @@
254254
{
255255
"cell_type": "code",
256256
"execution_count": null,
257-
"id": "0bc8cd83",
257+
"id": "13",
258258
"metadata": {},
259259
"outputs": [],
260260
"source": [
@@ -270,7 +270,7 @@
270270
},
271271
{
272272
"cell_type": "markdown",
273-
"id": "7d915aed",
273+
"id": "14",
274274
"metadata": {},
275275
"source": [
276276
"Instead of `time_of_year`, the output has `start_date`, `end_date`, and\n",
@@ -282,7 +282,7 @@
282282
{
283283
"cell_type": "code",
284284
"execution_count": null,
285-
"id": "cfe28029",
285+
"id": "15",
286286
"metadata": {},
287287
"outputs": [],
288288
"source": [
@@ -298,7 +298,7 @@
298298
},
299299
{
300300
"cell_type": "markdown",
301-
"id": "9c30978f",
301+
"id": "16",
302302
"metadata": {},
303303
"source": [
304304
"Filter the `interval_type` column (values `month`, `calendar_year`,\n",
@@ -308,7 +308,7 @@
308308
{
309309
"cell_type": "code",
310310
"execution_count": null,
311-
"id": "7ff90e81",
311+
"id": "17",
312312
"metadata": {},
313313
"outputs": [],
314314
"source": [
@@ -319,7 +319,7 @@
319319
},
320320
{
321321
"cell_type": "markdown",
322-
"id": "061b9cbe",
322+
"id": "18",
323323
"metadata": {},
324324
"source": [
325325
"### Monthly mean table\n",
@@ -333,7 +333,7 @@
333333
{
334334
"cell_type": "code",
335335
"execution_count": null,
336-
"id": "1c705056",
336+
"id": "19",
337337
"metadata": {},
338338
"outputs": [],
339339
"source": [
@@ -383,7 +383,7 @@
383383
},
384384
{
385385
"cell_type": "markdown",
386-
"id": "31cd8b14",
386+
"id": "20",
387387
"metadata": {},
388388
"source": [
389389
"## Statistics API tips\n",

0 commit comments

Comments
 (0)