diff --git a/dataretrieval/nwis.py b/dataretrieval/nwis.py index 5262854..57cbccf 100644 --- a/dataretrieval/nwis.py +++ b/dataretrieval/nwis.py @@ -939,6 +939,7 @@ def get_record(sites=None, start=None, end=None, - 'pmcodes': get parameter codes - 'water_use': get water use data - 'ratings': get rating table + - 'stat': get statistics **kwargs: optional If supplied, will be used as query parameters @@ -988,6 +989,11 @@ def get_record(sites=None, start=None, end=None, >>> df = dataretrieval.nwis.get_record( ... sites='01585200', service='ratings') + >>> # Get annual statistics for USGS station 01646500 + >>> df = dataretrieval.nwis.get_record( + ... sites='01646500', service='stat', statReportType='annual', + ... statYearType='water') + """ if service not in WATERSERVICES_SERVICES + WATERDATA_SERVICES: raise TypeError('Unrecognized service: {}'.format(service)) @@ -1041,6 +1047,10 @@ def get_record(sites=None, start=None, end=None, df, _ = get_ratings(site=sites, **kwargs) return df + elif service == 'stat': + df, _ = get_stats(sites=sites, **kwargs) + return df + else: raise TypeError('{} service not yet implemented'.format(service)) diff --git a/docs/source/examples/index.rst b/docs/source/examples/index.rst index 06af6cf..3472001 100644 --- a/docs/source/examples/index.rst +++ b/docs/source/examples/index.rst @@ -25,7 +25,7 @@ project repository. .. _Hydroshare: https://www.hydroshare.org/resource/c97c32ecf59b4dff90ef013030c54264/ -.. _demos/hydroshare: https://github.com/USGS-python/dataretrieval/tree/master/demos/hydroshare +.. _demos/hydroshare: https://github.com/DOI-USGS/dataretrieval-python/tree/master/demos/hydroshare .. toctree:: :maxdepth: 1 diff --git a/docs/source/examples/siteinfo_examples.rst b/docs/source/examples/siteinfo_examples.rst index 3ec2a14..4923f4a 100644 --- a/docs/source/examples/siteinfo_examples.rst +++ b/docs/source/examples/siteinfo_examples.rst @@ -13,7 +13,7 @@ the resulting column names for the output dataframes (example prompted by .. _NWIS water services documentation: https://nwis.waterservices.usgs.gov/rest/Site-Service.html -.. _GitHub Issue #34: https://github.com/USGS-python/dataretrieval/issues/34 +.. _GitHub Issue #34: https://github.com/DOI-USGS/dataretrieval-python/issues/34 .. doctest:: diff --git a/docs/source/meta/contributing.rst b/docs/source/meta/contributing.rst index 195a98f..fdc330b 100644 --- a/docs/source/meta/contributing.rst +++ b/docs/source/meta/contributing.rst @@ -11,7 +11,7 @@ Ways to contribute Reporting Bugs: ^^^^^^^^^^^^^^^ -Report bugs at https://github.com/USGS-python/dataretrieval/issues +Report bugs at https://github.com/DOI-USGS/dataretrieval-python/issues When reporting a bug, please include: @@ -44,7 +44,7 @@ Submitting Feedback: ^^^^^^^^^^^^^^^^^^^^ The best way to send feedback is to file an issue at -https://github.com/USGS-python/dataretrieval/issues +https://github.com/DOI-USGS/dataretrieval-python/issues If you are proposing a feature: diff --git a/docs/source/meta/installing.rst b/docs/source/meta/installing.rst index b34c537..8a205a6 100644 --- a/docs/source/meta/installing.rst +++ b/docs/source/meta/installing.rst @@ -7,9 +7,9 @@ or ``conda``. Package dependencies are listed in the `requirements.txt`_ file, a full list of dependencies necessary for development are listed in the `requirements-dev.txt`_ file. -.. _requirements.txt: https://github.com/USGS-python/dataretrieval/blob/master/requirements.txt +.. _requirements.txt: https://github.com/DOI-USGS/dataretrieval-python/blob/master/requirements.txt -.. _requirements-dev.txt: https://github.com/USGS-python/dataretrieval/blob/master/requirements-dev.txt +.. _requirements-dev.txt: https://github.com/DOI-USGS/dataretrieval-python/blob/master/requirements-dev.txt User Installation @@ -51,7 +51,7 @@ The first step is to clone your fork of the repository: .. code-block:: bash - $ git clone https://github.com/USGS-python/dataretrieval.git + $ git clone https://github.com/DOI-USGS/dataretrieval-python.git Then, set the cloned repository as your current working directory in your terminal and run the following commands to get an "editable" installation of @@ -74,7 +74,7 @@ defining the main repository as a remote `upstream` repository: .. code-block:: bash - $ git remote add upstream https://github.com/USGS-python/dataretrieval.git + $ git remote add upstream https://github.com/DOI-USGS/dataretrieval-python.git You can also build the documentation locally by running the following commands: diff --git a/docs/source/meta/license.rst b/docs/source/meta/license.rst index e5fead0..975461b 100644 --- a/docs/source/meta/license.rst +++ b/docs/source/meta/license.rst @@ -7,6 +7,6 @@ States Geological Survey, an agency of the United States Department of Interior. For more information, see the `LICENSE.md`_ file. See the `Disclaimer.md`_ file for more information about the disclaimer. -.. _LICENSE.md: https://github.com/USGS-python/dataretrieval/blob/master/LICENSE.md +.. _LICENSE.md: https://github.com/DOI-USGS/dataretrieval-python/blob/master/LICENSE.md -.. _Disclaimer.md: https://github.com/USGS-python/dataretrieval/blob/master/Disclaimer.md \ No newline at end of file +.. _Disclaimer.md: https://github.com/DOI-USGS/dataretrieval-python/blob/master/DISCLAIMER.md \ No newline at end of file diff --git a/docs/source/userguide/timeconventions.rst b/docs/source/userguide/timeconventions.rst index 60fab8f..8336be5 100644 --- a/docs/source/userguide/timeconventions.rst +++ b/docs/source/userguide/timeconventions.rst @@ -13,7 +13,7 @@ the exception to this is when incomplete datetime information is available, in these cases integers are used as the dataframe index (see `PR#58`_ for more details). -.. _PR#58: https://github.com/USGS-python/dataretrieval/pull/58 +.. _PR#58: https://github.com/DOI-USGS/dataretrieval-python/pull/58 Inspecting Timestamps diff --git a/tests/waterservices_test.py b/tests/waterservices_test.py index 5359909..7dc780e 100755 --- a/tests/waterservices_test.py +++ b/tests/waterservices_test.py @@ -57,10 +57,6 @@ def test_get_record_validation(): get_record(sites=['01491000'], service='not_a_service') assert 'Unrecognized service: not_a_service' == str(type_error.value) - with pytest.raises(TypeError) as type_error: - get_record(sites=['01491000'], service='stat') - assert 'stat service not yet implemented' == str(type_error.value) - def test_get_dv(requests_mock): """Tests get_dv method correctly generates the request url and returns the result in a DataFrame"""