Commit 541c652
fix(nwis): forward get_record
Three fixes in the (deprecated) nwis module:
1. get_record's `state` argument was accepted and documented but never
forwarded, so get_record(state="OH", service="site") silently ignored it and
failed with a confusing "Bad Request". Forward it as the NWIS `stateCd`
major filter.
2. get_dv / get_iv / get_discharge_peaks did
`kwargs["sites"] = kwargs.pop("sites", sites)`, always injecting the key (as
None when absent) and so defeating query_waterservices' "must specify a
major filter" check — get_dv()/get_iv() with no filter raised a confusing
"Bad Request" instead of the intended TypeError. Inject only when provided.
3. get_dv / get_iv passed `format="json"` explicitly alongside **kwargs, so
get_dv(sites=..., format="rdb") raised "got multiple values for 'format'".
These getters only parse JSON, so reject a non-json format with a clear
ValueError.
`wide_format` / `datetime_index` on get_record remain accepted but
unimplemented (unchanged here); wiring or removing them is a separate decision
for this deprecated module.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>state, restore major-filter check, clarify format1 parent ee653e5 commit 541c652
2 files changed
Lines changed: 57 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
534 | 535 | | |
535 | 536 | | |
536 | 537 | | |
537 | | - | |
| 538 | + | |
| 539 | + | |
538 | 540 | | |
539 | 541 | | |
| 542 | + | |
| 543 | + | |
540 | 544 | | |
541 | 545 | | |
542 | 546 | | |
| |||
719 | 723 | | |
720 | 724 | | |
721 | 725 | | |
722 | | - | |
| 726 | + | |
| 727 | + | |
723 | 728 | | |
724 | 729 | | |
| 730 | + | |
| 731 | + | |
725 | 732 | | |
726 | 733 | | |
727 | 734 | | |
| |||
952 | 959 | | |
953 | 960 | | |
954 | 961 | | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
955 | 968 | | |
956 | 969 | | |
957 | 970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
123 | 164 | | |
124 | 165 | | |
125 | 166 | | |
| |||
0 commit comments