Skip to content

Commit

Permalink
Merge pull request #240 from mhearne-usgs/stationfix
Browse files Browse the repository at this point in the history
Fixing issue when a shakemap is missing station list
  • Loading branch information
mhearne-usgs authored Mar 31, 2021
2 parents cb87df9 + cf090c2 commit bfbc5bf
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions libcomcat/dataframes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,15 +1156,18 @@ def _get_shakemap_info(product):
# get from stations
# - number instrumented stations
# - number dyfi
stationbytes = product.getContentBytes('stationlist.json')[0]
stationdict = json.loads(stationbytes.decode('utf-8'))
ninstrument = 0
ndyfi = 0
for feature in stationdict['features']:
if feature['properties']['source'] == 'DYFI':
ndyfi += 1
else:
ninstrument += 1
if len(product.getContentsMatching('stationlist')):
stationbytes = product.getContentBytes('stationlist.json')[0]
stationdict = json.loads(stationbytes.decode('utf-8'))
ninstrument = 0
ndyfi = 0
for feature in stationdict['features']:
if feature['properties']['source'] == 'DYFI':
ndyfi += 1
else:
ninstrument += 1
elif len(product.getContentsMatching('info.xml')):
infobytes = product.getContentBytes('info.xml')[0]
root = minidom.parseString(infobytes.decode('utf-8'))
Expand Down

0 comments on commit bfbc5bf

Please sign in to comment.