Skip to content

Commit a38deb1

Browse files
committed
Remove qwdata example and NADP fix
1 parent 33bba33 commit a38deb1

3 files changed

Lines changed: 13 additions & 24 deletions

File tree

dataretrieval/nadp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
"""
3131

3232
import io
33-
import os
3433
import re
3534
import zipfile
36-
from os.path import basename
3735

3836
import requests
3937

@@ -118,7 +116,7 @@ def get_annual_MDN_map(measurement_type, year, path):
118116
if path:
119117
z.extractall(path)
120118

121-
return f"{path}{os.sep}{basename(filename)}"
119+
return str(path)
122120

123121

124122
def get_annual_NTN_map(measurement_type, measurement=None, year=None, path="."):
@@ -174,7 +172,7 @@ def get_annual_NTN_map(measurement_type, measurement=None, year=None, path="."):
174172
if path:
175173
z.extractall(path)
176174

177-
return f"{path}{os.sep}{basename(filename)}"
175+
return str(path)
178176

179177

180178
def get_zip(url, filename):

docs/source/examples/readme_examples.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ Examples from the Readme file on retrieving NWIS data
2929
<BLANKLINE>
3030
[5 rows x 21 columns]
3131

32-
>>> # get water quality samples (qwdata)
33-
>>> df2 = nwis.get_record(sites=site, service='qwdata', start='2018-12-01', end='2019-01-01')
34-
35-
>>> print(df2)
36-
agency_cd site_no sample_dt sample_tm sample_end_dt sample_end_tm ... p80154 p82398 p84164 p91157 p91158 p91159
37-
datetime ...
38-
2018-12-10 17:30:00+00:00 USGS 03339000 2018-12-10 11:30 NaN NaN ... 16 50 3060 0.0165 0.0141 0.0024
39-
<BLANKLINE>
40-
[1 rows x 33 columns]
4132

4233
>>> # get basic info about the site
4334
>>> df3 = nwis.get_record(sites=site, service='site')

tests/nadp_test.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def test_get_annual_MDN_map_zip(self, tmp_path):
1919
z_path = nadp.get_annual_MDN_map(
2020
measurement_type="conc", year="2010", path=tmp_path
2121
)
22-
exp_path = os.path.join(tmp_path, "Hg_conc_2010.zip")
23-
# assert path matches expectation
24-
assert z_path == str(exp_path)
25-
# assert unpacked zip exists as a directory
26-
assert os.path.exists(exp_path[:-4])
22+
# assert path matches expectation (now returns the path directory)
23+
assert z_path == str(tmp_path)
24+
# assert unpacked directory exists
25+
exp_dir = os.path.join(tmp_path, "Hg_conc_2010")
26+
assert os.path.exists(exp_dir)
2727
# assert tif exists in directory
28-
assert os.path.exists(os.path.join(z_path[:-4], "conc_Hg_2010.tif"))
28+
assert os.path.exists(os.path.join(exp_dir, "conc_Hg_2010.tif"))
2929

3030

3131
class TestNTNmap:
@@ -36,10 +36,10 @@ def test_get_annual_NTN_map_zip(self, tmp_path):
3636
z_path = nadp.get_annual_NTN_map(
3737
measurement_type="Precip", year="2015", path=tmp_path
3838
)
39-
exp_path = os.path.join(tmp_path, "Precip_2015.zip")
4039
# assert path matches expectation
41-
assert z_path == str(exp_path)
42-
# assert unpacked zip exists as a directory
43-
assert os.path.exists(exp_path[:-4])
40+
assert z_path == str(tmp_path)
41+
# assert unpacked directory exists
42+
exp_dir = os.path.join(tmp_path, "Precip_2015")
43+
assert os.path.exists(exp_dir)
4444
# assert tif exists in directory
45-
assert os.path.exists(os.path.join(z_path[:-4], "Precip_2015.tif"))
45+
assert os.path.exists(os.path.join(exp_dir, "Precip_2015.tif"))

0 commit comments

Comments
 (0)