@@ -74,7 +74,7 @@ def test_get_usgs_stations():
74
74
stations = usgs .get_usgs_stations ()
75
75
assert isinstance (stations , pd .DataFrame )
76
76
assert isinstance (stations , gpd .GeoDataFrame )
77
- assert 40000 > len (stations ) > 35000
77
+ assert 40000 > len (stations ) > 30000
78
78
# check that the DataFrame has the right columns
79
79
assert set (stations .columns ).issuperset (usgs .USGS_STATIONS_COLUMN_NAMES )
80
80
# Check that the parsing of the dates has been done correctly
@@ -90,8 +90,8 @@ def test_usgs_metadata_has_state_info():
90
90
@pytest .mark .parametrize (
91
91
"truncate_seconds,no_records" ,
92
92
[
93
- pytest .param (True , 11 , id = "truncate_seconds=True" ),
94
- pytest .param (False , 11 , id = "truncate_seconds=False" ),
93
+ pytest .param (True , 18 , id = "truncate_seconds=True" ),
94
+ pytest .param (False , 18 , id = "truncate_seconds=False" ),
95
95
],
96
96
)
97
97
def test_get_usgs_station_data (truncate_seconds , no_records ):
@@ -142,7 +142,7 @@ def test_get_usgs_data(truncate_seconds):
142
142
)
143
143
assert isinstance (ds , xr .Dataset )
144
144
# TODO: Check if truncate_seconds does work
145
- assert len (ds .datetime ) == 222
145
+ assert len (ds .datetime ) == 226
146
146
assert len (ds .site_no ) == len (usgs_metadata )
147
147
# Check that usgs_code, lon, lat, country and location are not modified
148
148
assert set (ds .site_no .values ).issubset (usgs_metadata .site_no .values )
@@ -151,8 +151,9 @@ def test_get_usgs_data(truncate_seconds):
151
151
# assert set(ds.country.values).issubset(usgs_metadata.country.values)
152
152
# assert set(ds.location.values).issubset(usgs_metadata.location.values)
153
153
# Check that actual data has been retrieved
154
- assert ds .sel (site_no = "15056500" , code = "72330" ).value .mean () == pytest .approx (109.94 , rel = 1e-3 )
155
- assert ds .sel (site_no = "15484000" , code = "72330" ).value .mean () == pytest .approx (637.84 , rel = 1e-3 )
154
+ code = "00065"
155
+ assert ds .sel (site_no = "15056500" , code = code ).value .mean () == pytest .approx (125.30 , rel = 1e-3 )
156
+ assert ds .sel (site_no = "15484000" , code = code ).value .mean () == pytest .approx (323.24 , rel = 1e-3 )
156
157
157
158
158
159
def test_get_usgs_station_data_by_string_enddate ():
@@ -163,7 +164,7 @@ def test_get_usgs_station_data_by_string_enddate():
163
164
truncate_seconds = False ,
164
165
)
165
166
166
- assert len (df ) == 17
167
+ assert len (df ) == 30
167
168
168
169
dates = pd .to_datetime (df .index .get_level_values ("datetime" ).to_series ().dt .date .unique ())
169
170
assert len (dates ) == 4
0 commit comments