|
36 | 36 |
|
37 | 37 | WATERSERVICES_SERVICES = ["dv", "iv", "site", "stat"] |
38 | 38 | WATERDATA_SERVICES = [ |
39 | | - "qwdata", |
40 | 39 | "gwlevels", |
41 | 40 | "measurements", |
42 | 41 | "peaks", |
@@ -135,125 +134,14 @@ def get_qwdata( |
135 | 134 | **kwargs, |
136 | 135 | ) -> Tuple[pd.DataFrame, BaseMetadata]: |
137 | 136 | """ |
138 | | - Get water sample data from qwdata service. |
139 | | -
|
140 | | - .. warning:: |
141 | | -
|
142 | | - WARNING: Beginning in March 2024 the NWIS qw data endpoint will |
143 | | - not deliver new data or updates to existing data. |
144 | | - Eventually the endpoint will be retired. For updated information visit: |
145 | | - https://waterdata.usgs.gov.nwis/qwdata |
146 | | - For additional details, see the R package vignette: |
147 | | - https://doi-usgs.github.io/dataRetrieval/articles/Status.html |
148 | | - If you have additional questions about the qw data service, |
149 | | - email CompTools@usgs.gov. |
150 | | -
|
151 | | - Parameters |
152 | | - ---------- |
153 | | - sites: string or list of strings, optional, default is None |
154 | | - If the qwdata parameter site_no is supplied, it will overwrite the |
155 | | - sites parameter |
156 | | - start: string, optional, default is None |
157 | | - If the qwdata parameter begin_date is supplied, it will overwrite the |
158 | | - start parameter (YYYY-MM-DD) |
159 | | - end: string, optional, default is None |
160 | | - If the qwdata parameter end_date is supplied, it will overwrite the |
161 | | - end parameter (YYYY-MM-DD) |
162 | | - multi_index: bool, optional |
163 | | - If False, a dataframe with a single-level index (datetime) is returned, |
164 | | - default is True |
165 | | - wide_format : bool, optional |
166 | | - If True, return data in wide format with multiple samples per row and |
167 | | - one row per time, default is True |
168 | | - datetime_index : bool, optional |
169 | | - If True, create a datetime index, default is True |
170 | | - ssl_check: bool, optional |
171 | | - If True, check SSL certificates, if False, do not check SSL, |
172 | | - default is True |
173 | | - **kwargs: optional |
174 | | - If supplied, will be used as query parameters |
175 | | -
|
176 | | - Returns |
177 | | - ------- |
178 | | - df: ``pandas.DataFrame`` |
179 | | - Times series data from the NWIS JSON |
180 | | - md: :obj:`dataretrieval.utils.Metadata` |
181 | | - A custom metadata object |
182 | | -
|
183 | | - Examples |
184 | | - -------- |
185 | | - .. doctest:: |
186 | | -
|
187 | | - >>> # get water sample information for site 11447650 |
188 | | - >>> df, md = dataretrieval.nwis.get_qwdata( |
189 | | - ... sites="11447650", start="2010-01-01", end="2010-02-01" |
190 | | - ... ) |
| 137 | + Get water sample data from qwdata service - deprecated, use `get_usgs_samples()` |
| 138 | + in the samples module. |
191 | 139 |
|
192 | 140 | """ |
193 | | - warnings.warn( |
194 | | - ( |
195 | | - "WARNING: Starting in March 2024, the NWIS qw data endpoint is " |
196 | | - "retiring and no longer receives updates. For more information, " |
197 | | - "refer to https://waterdata.usgs.gov.nwis/qwdata and " |
198 | | - "https://doi-usgs.github.io/dataRetrieval/articles/Status.html " |
199 | | - "or email CompTools@usgs.gov." |
200 | | - ) |
201 | | - ) |
202 | | - |
203 | | - _check_sites_value_types(sites) |
204 | | - |
205 | | - kwargs["site_no"] = kwargs.pop("site_no", sites) |
206 | | - kwargs["begin_date"] = kwargs.pop("begin_date", start) |
207 | | - kwargs["end_date"] = kwargs.pop("end_date", end) |
208 | | - kwargs["multi_index"] = multi_index |
209 | | - if wide_format: |
210 | | - kwargs["qw_sample_wide"] = "qw_sample_wide" |
211 | | - |
212 | | - payload = { |
213 | | - "agency_cd": "USGS", |
214 | | - "format": "rdb", |
215 | | - "pm_cd_compare": "Greater than", |
216 | | - "inventory_output": "0", |
217 | | - "rdb_inventory_output": "file", |
218 | | - "TZoutput": "0", |
219 | | - "rdb_qw_attributes": "expanded", |
220 | | - "date_format": "YYYY-MM-DD", |
221 | | - "rdb_compression": "value", |
222 | | - "submitted_form": "brief_list", |
223 | | - } |
224 | | - |
225 | | - # check for parameter codes, and reformat query args |
226 | | - qwdata_parameter_code_field = "parameterCd" |
227 | | - if kwargs.get(qwdata_parameter_code_field): |
228 | | - parameter_codes = kwargs.pop(qwdata_parameter_code_field) |
229 | | - parameter_codes = to_str(parameter_codes) |
230 | | - kwargs["multiple_parameter_cds"] = parameter_codes |
231 | | - kwargs["param_cd_operator"] = "OR" |
232 | | - |
233 | | - search_criteria = kwargs.get("list_of_search_criteria") |
234 | | - if search_criteria: |
235 | | - kwargs["list_of_search_criteria"] = "{},{}".format( |
236 | | - search_criteria, "multiple_parameter_cds" |
237 | | - ) |
238 | | - else: |
239 | | - kwargs["list_of_search_criteria"] = "multiple_parameter_cds" |
240 | | - |
241 | | - kwargs.update(payload) |
242 | | - |
243 | | - warnings.warn( |
244 | | - "NWIS qw web services are being retired. " |
245 | | - + "See this note from the R package for more: " |
246 | | - + "https://doi-usgs.github.io/dataRetrieval/articles/qwdata_changes.html", |
247 | | - category=DeprecationWarning, |
248 | | - ) |
249 | | - response = query_waterdata("qwdata", ssl_check=ssl_check, **kwargs) |
250 | | - |
251 | | - df = _read_rdb(response.text) |
252 | | - |
253 | | - if datetime_index is True: |
254 | | - df = format_datetime(df, "sample_dt", "sample_tm", "sample_start_time_datum_cd") |
255 | | - |
256 | | - return format_response(df, **kwargs), NWIS_Metadata(response, **kwargs) |
| 141 | + return print("This function is deprecated and has been " \ |
| 142 | + "replaced with `get_usgs_samples() in the " \ |
| 143 | + "samples module. If you have questions, " \ |
| 144 | + "please reach out to comptools@usgs.gov") |
257 | 145 |
|
258 | 146 |
|
259 | 147 | def get_discharge_measurements( |
|
0 commit comments