Skip to content

Commit

Permalink
Merge pull request #76 from benjwadams/fix_station_counts_tests
Browse files Browse the repository at this point in the history
Update NDBC station counts to fix tests
daf authored Jan 19, 2017
2 parents dc281f1 + bafd1d1 commit e3f8479
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/collectors/test_ndbc_sos.py
Original file line number Diff line number Diff line change
@@ -62,8 +62,8 @@ def test_raw_ndbc_get_observation_all_stations(self):

data = list(csv.DictReader(io.StringIO(response)))
stations = list(set([x['station_id'] for x in data]))
# 265 stations measured air_pressure that day
assert len(stations) == 265
# 264 stations measured air_pressure that day
assert len(stations) == 264

"""
station_id,sensor_id,"latitude (degree)","longitude (degree)",date_time,"depth (m)","air_pressure_at_sea_level (hPa)"
@@ -86,8 +86,8 @@ def test_raw_ndbc_get_observation_no_stations(self):

data = list(csv.DictReader(io.StringIO(response)))
stations = list(set([x['station_id'] for x in data]))
# 265 stations measured air_pressure that day
assert len(stations) == 265
# 264 stations measured air_pressure that day
assert len(stations) == 264

"""
station_id,sensor_id,"latitude (degree)","longitude (degree)",date_time,"depth (m)","air_pressure_at_sea_level (hPa)"
8 changes: 6 additions & 2 deletions tests/parsers/test_ioos_get_observation.py
Original file line number Diff line number Diff line change
@@ -47,7 +47,8 @@ def test_o_and_m_get_observation(self):
assert ts.location["urn:ioos:station:wmo:41002"].equals(Point(-75.415, 32.382))

def test_timeseries_multi_station_multi_sensor(self):
swe = open(resource_file('ioos_swe/SWE-MultiStation-TimeSeries.xml'), 'rb').read()
swe = open(resource_file('ioos_swe/SWE-MultiStation-TimeSeries.xml'),
'rb').read()
data_record = etree.fromstring(swe)
collection = TimeSeries(data_record).feature

@@ -67,7 +68,10 @@ def test_timeseries_single_station_single_sensor(self):
assert station.location.y == 32.382
assert station.location.z == 0.5

assert sorted([x.time.strftime("%Y-%m-%dT%H:%M:%SZ") for x in station.elements]) == sorted(["2009-05-23T00:00:00Z", "2009-05-23T01:00:00Z", "2009-05-23T02:00:00Z"])
assert sorted([x.time.strftime("%Y-%m-%dT%H:%M:%SZ") for x in
station.elements]) == sorted(["2009-05-23T00:00:00Z",
"2009-05-23T01:00:00Z",
"2009-05-23T02:00:00Z"])

first_members = station.elements[0].members
assert sorted([x['value'] for x in first_members]) == sorted([2.0, 15.4, 280])

0 comments on commit e3f8479

Please sign in to comment.