|
2 | 2 | Retrieving site information |
3 | 3 | --------------------------- |
4 | 4 |
|
5 | | -By default ``dataretrieval`` fetches the so-called "expanded" site date from |
6 | | -the NWIS web service. However there is an optional keyword parameter called |
7 | | -``seriesCatalogOutput`` that can be set to "True" if you wish to retrieve the |
8 | | -detailed period of record information for a site instead. Refer to the |
9 | | -`NWIS water services documentation`_ for additional information. The below |
10 | | -example illustrates the use of the ``seriesCatalogOutput`` switch and displays |
11 | | -the resulting column names for the output dataframes (example prompted by |
12 | | -`GitHub Issue #34`_). |
13 | | - |
14 | | -.. _NWIS water services documentation: https://waterservices.usgs.gov/docs/site-service/site-service-details/ |
15 | | - |
16 | | -.. _GitHub Issue #34: https://github.com/DOI-USGS/dataretrieval-python/issues/34 |
17 | | - |
18 | | -.. doctest:: |
19 | | - |
20 | | - # first import the functions for downloading data from NWIS |
21 | | - >>> import dataretrieval.nwis as nwis |
22 | | - |
23 | | - # fetch data from a major HUC basin with seriesCatalogOutput set to True |
24 | | - >>> df = nwis.get_record(huc='20', parameterCd='00060', |
25 | | - ... service='site', seriesCatalogOutput='True') |
26 | | - |
27 | | - >>> print(df.columns) |
28 | | - Index(['agency_cd', 'site_no', 'station_nm', 'site_tp_cd', 'dec_lat_va', |
29 | | - 'dec_long_va', 'coord_acy_cd', 'dec_coord_datum_cd', 'alt_va', |
30 | | - 'alt_acy_va', 'alt_datum_cd', 'huc_cd', 'data_type_cd', 'parm_cd', |
31 | | - 'stat_cd', 'ts_id', 'loc_web_ds', 'medium_grp_cd', 'parm_grp_cd', |
32 | | - 'srs_id', 'access_cd', 'begin_date', 'end_date', 'count_nu'], |
33 | | - dtype='object') |
34 | | - |
35 | | - # repeat the same query with seriesCatalogOutput set as False |
36 | | - >>> df = nwis.get_record(huc='20', parameterCd='00060', |
37 | | - ... service='site', seriesCatalogOutput='False') |
38 | | - |
39 | | - >>> print(df.columns) |
40 | | - Index(['agency_cd', 'site_no', 'station_nm', 'site_tp_cd', 'lat_va', 'long_va', |
41 | | - 'dec_lat_va', 'dec_long_va', 'coord_meth_cd', 'coord_acy_cd', |
42 | | - 'coord_datum_cd', 'dec_coord_datum_cd', 'district_cd', 'state_cd', |
43 | | - 'county_cd', 'country_cd', 'land_net_ds', 'map_nm', 'map_scale_fc', |
44 | | - 'alt_va', 'alt_meth_cd', 'alt_acy_va', 'alt_datum_cd', 'huc_cd', |
45 | | - 'basin_cd', 'topo_cd', 'instruments_cd', 'construction_dt', |
46 | | - 'inventory_dt', 'drain_area_va', 'contrib_drain_area_va', 'tz_cd', |
47 | | - 'local_time_fg', 'reliability_cd', 'gw_file_cd', 'nat_aqfr_cd', |
48 | | - 'aqfr_cd', 'aqfr_type_cd', 'well_depth_va', 'hole_depth_va', |
49 | | - 'depth_src_cd', 'project_no'], |
50 | | - dtype='object') |
| 5 | +The ``waterdata`` module distinguishes a monitoring location's *descriptive* |
| 6 | +metadata from the *catalog* of data available at it. |
| 7 | + |
| 8 | +Use ``get_monitoring_locations`` for descriptive metadata — name, location, |
| 9 | +site type, drainage area, hydrologic unit, and so on. |
| 10 | + |
| 11 | +.. code:: python |
| 12 | +
|
| 13 | + >>> from dataretrieval import waterdata |
| 14 | +
|
| 15 | + >>> info, md = waterdata.get_monitoring_locations( |
| 16 | + ... monitoring_location_id="USGS-05427718", |
| 17 | + ... skip_geometry=True, |
| 18 | + ... ) |
| 19 | +
|
| 20 | + >>> info[["monitoring_location_name", "site_type", "drainage_area", "hydrologic_unit_code"]].T |
| 21 | + 0 |
| 22 | + monitoring_location_name YAHARA RIVER AT WINDSOR, WI |
| 23 | + site_type Stream |
| 24 | + drainage_area 73.6 |
| 25 | + hydrologic_unit_code 070900020504 |
| 26 | +
|
| 27 | +To discover *what data are available* at a location — the period-of-record |
| 28 | +catalog that the legacy ``seriesCatalogOutput`` switch used to provide — use |
| 29 | +``get_time_series_metadata``. Each row is one time series; the ``begin`` and |
| 30 | +``end`` columns give its period of record. |
| 31 | + |
| 32 | +.. code:: python |
| 33 | +
|
| 34 | + >>> series, md = waterdata.get_time_series_metadata( |
| 35 | + ... monitoring_location_id="USGS-05427718", |
| 36 | + ... skip_geometry=True, |
| 37 | + ... ) |
| 38 | +
|
| 39 | + >>> len(series) # number of available time series |
| 40 | + 22 |
| 41 | +
|
| 42 | + >>> series[["parameter_code", "parameter_name", "computation_period_identifier"]].head() |
| 43 | + parameter_code parameter_name computation_period_identifier |
| 44 | + 0 00045 Precipitation Points |
| 45 | + 1 91060 Orthophosphate, diss Daily |
| 46 | + 2 91057 NH3+orgN, wu as N Daily |
| 47 | + 3 00060 Discharge Points |
| 48 | + 4 80155 Suspnd sedmnt disch Daily |
0 commit comments