Commit 20daa00
feat(waterdata): add waterdata.xarray module returning CF datasets
Add dataretrieval.waterdata.xarray, optional-dependency wrappers that
mirror the Water Data time-series getters but return CF-conventions
xarray.Dataset objects instead of bare DataFrames.
- Ragged (CF contiguous ragged array) layout by default; pass dense=True
for the NaN-filled (monitoring_location_id, time) grid with one named
variable per parameter.
- CF metadata is derived from columns the getters already return
(unit_of_measure -> units, statistic_id -> cell_methods,
parameter_code -> standard_name/vertical_datum), plus a cached
parameter-name lookup; sites carry cf_role=timeseries_id with lon/lat.
- Coverage: get_daily, get_continuous, get_latest_continuous,
get_latest_daily, get_nearest_continuous, get_peaks,
get_field_measurements, get_samples, and preliminary
get_stats_por / get_stats_date_range.
- xarray is an optional extra (pip install dataretrieval[xarray]); the
core package never imports it. Hash-valued ID columns are dropped
inside the xarray builders, so the plain getters are left untouched.
CF vocabulary maps live in waterdata.types (xarray-free, plain data).
Adds a demo notebook + docs entry and offline converter unit tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ad4e980 commit 20daa00
7 files changed
Lines changed: 2348 additions & 0 deletions
File tree
- dataretrieval/waterdata
- demos
- docs/source/examples
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
0 commit comments