Skip to content

Commit 5daa03d

Browse files
committed
remove duplicate locations
1 parent a0bab02 commit 5daa03d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/acquisition/fluview/fluview.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,24 @@ def get_tier_ids(name):
9292

9393
for row in data[Key.TierListEntry.hhs]:
9494
location_ids[Key.TierType.hhs].append(row[Key.TierIdEntry.hhs])
95-
if len(location_ids[Key.TierType.hhs]) != 10:
96-
raise Exception('expected 10 hhs regions')
95+
location_ids[Key.TierType.hhs] = sorted(set(location_ids[Key.TierType.hhs]))
96+
num = len(location_ids[Key.TierType.hhs])
97+
if num != 10:
98+
raise Exception('expected 10 hhs regions, found %s' % num)
9799

98100
for row in data[Key.TierListEntry.cen]:
99101
location_ids[Key.TierType.cen].append(row[Key.TierIdEntry.cen])
100-
if len(location_ids[Key.TierType.cen]) != 9:
101-
raise Exception('expected 9 census divisions')
102+
location_ids[Key.TierType.cen] = sorted(set(location_ids[Key.TierType.cen]))
103+
num = len(location_ids[Key.TierType.cen])
104+
if num != 9:
105+
raise Exception('expected 9 census divisions, found %s' % num)
102106

103107
for row in data[Key.TierListEntry.sta]:
104108
location_ids[Key.TierType.sta].append(row[Key.TierIdEntry.sta])
105-
if len(location_ids[Key.TierType.sta]) != 57:
106-
raise Exception('expected 57 states/territories/cities')
109+
location_ids[Key.TierType.sta] = sorted(set(location_ids[Key.TierType.sta]))
110+
num = len(location_ids[Key.TierType.sta])
111+
if num != 57:
112+
raise Exception('expected 57 states/territories/cities, found %s' % num)
107113

108114
# return a useful subset of the metatdata
109115
return {

0 commit comments

Comments
 (0)