Commit 6510ff0
Deprecate the remaining active nwis functions ahead of 2027-05-06 removal
The module-level "use waterdata instead" warning has been firing on
import for a while; this PR makes the migration guidance actionable
by emitting a per-function DeprecationWarning that names the specific
waterdata replacement the user should switch to.
Once peaks (DOI-USGS#267) and ratings (DOI-USGS#269) land, every active nwis function
has a waterdata replacement, so all nine of them are deprecated here:
nwis.get_dv -> waterdata.get_daily()
nwis.get_iv -> waterdata.get_continuous()
nwis.get_info -> waterdata.get_monitoring_locations()
nwis.what_sites -> waterdata.get_monitoring_locations()
nwis.get_stats -> waterdata.get_stats_por() /
waterdata.get_stats_date_range()
nwis.get_discharge_peaks -> waterdata.get_peaks()
nwis.get_ratings -> waterdata.get_ratings()
nwis.get_record -> the appropriate waterdata.get_*()
nwis.query_waterdata -> a high-level waterdata.get_*() helper
nwis.query_waterservices -> a high-level waterdata.get_*() helper
(get_qwdata, get_discharge_measurements, get_gwlevels, get_pmcodes,
and get_water_use are already defunct and raise NameError.)
Implementation follows the nadp deprecation template (DOI-USGS#243): a small
_REPLACEMENTS dict + a _warn_deprecated(func_name) helper called as
the first line of each public function. stacklevel=3 makes the
warning point at the caller's code, not the helper's frame.
11 new parametrized tests pin the warning text — that the function
name appears, the replacement helper appears, and the removal date
appears — plus one end-to-end test that get_iv() actually fires
its warning when called.
Removal date is set to 2027-05-06, one full year out (vs. the six
months used for nadp), since nwis is much more widely used and most
users will need migration time. Maintainer can adjust if desired.
This depends on DOI-USGS#267 (waterdata.get_peaks) and DOI-USGS#269 (waterdata.get_ratings)
being merged: until then the deprecation messages for get_discharge_peaks
and get_ratings point at functions users can't yet call. Hold this PR
draft until those land.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent fca3d6c commit 6510ff0
3 files changed
Lines changed: 88 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
56 | 85 | | |
57 | 86 | | |
58 | 87 | | |
| |||
216 | 245 | | |
217 | 246 | | |
218 | 247 | | |
| 248 | + | |
219 | 249 | | |
220 | 250 | | |
221 | 251 | | |
| |||
292 | 322 | | |
293 | 323 | | |
294 | 324 | | |
| 325 | + | |
295 | 326 | | |
296 | 327 | | |
297 | 328 | | |
| |||
322 | 353 | | |
323 | 354 | | |
324 | 355 | | |
| 356 | + | |
325 | 357 | | |
326 | 358 | | |
327 | 359 | | |
| |||
391 | 423 | | |
392 | 424 | | |
393 | 425 | | |
| 426 | + | |
394 | 427 | | |
395 | 428 | | |
396 | 429 | | |
| |||
467 | 500 | | |
468 | 501 | | |
469 | 502 | | |
| 503 | + | |
470 | 504 | | |
471 | 505 | | |
472 | 506 | | |
| |||
572 | 606 | | |
573 | 607 | | |
574 | 608 | | |
| 609 | + | |
575 | 610 | | |
576 | 611 | | |
577 | 612 | | |
| |||
650 | 685 | | |
651 | 686 | | |
652 | 687 | | |
| 688 | + | |
653 | 689 | | |
654 | 690 | | |
655 | 691 | | |
| |||
719 | 755 | | |
720 | 756 | | |
721 | 757 | | |
| 758 | + | |
722 | 759 | | |
723 | 760 | | |
724 | 761 | | |
| |||
767 | 804 | | |
768 | 805 | | |
769 | 806 | | |
| 807 | + | |
770 | 808 | | |
771 | 809 | | |
772 | 810 | | |
| |||
863 | 901 | | |
864 | 902 | | |
865 | 903 | | |
| 904 | + | |
866 | 905 | | |
867 | 906 | | |
868 | 907 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 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 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
121 | 168 | | |
122 | 169 | | |
123 | 170 | | |
| |||
0 commit comments