Skip to content

Commit bfbc5bf

Browse files
author
Mike Hearne
authored
Merge pull request #240 from mhearne-usgs/stationfix
Fixing issue when a shakemap is missing station list
2 parents cb87df9 + cf090c2 commit bfbc5bf

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

libcomcat/dataframes.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,15 +1156,18 @@ def _get_shakemap_info(product):
11561156
# get from stations
11571157
# - number instrumented stations
11581158
# - number dyfi
1159-
stationbytes = product.getContentBytes('stationlist.json')[0]
1160-
stationdict = json.loads(stationbytes.decode('utf-8'))
11611159
ninstrument = 0
11621160
ndyfi = 0
1163-
for feature in stationdict['features']:
1164-
if feature['properties']['source'] == 'DYFI':
1165-
ndyfi += 1
1166-
else:
1167-
ninstrument += 1
1161+
if len(product.getContentsMatching('stationlist')):
1162+
stationbytes = product.getContentBytes('stationlist.json')[0]
1163+
stationdict = json.loads(stationbytes.decode('utf-8'))
1164+
ninstrument = 0
1165+
ndyfi = 0
1166+
for feature in stationdict['features']:
1167+
if feature['properties']['source'] == 'DYFI':
1168+
ndyfi += 1
1169+
else:
1170+
ninstrument += 1
11681171
elif len(product.getContentsMatching('info.xml')):
11691172
infobytes = product.getContentBytes('info.xml')[0]
11701173
root = minidom.parseString(infobytes.decode('utf-8'))

0 commit comments

Comments
 (0)