With the bult-in package json
you can load a JSON object in Python.
import math
import json
# Open JSON file
f = open('data.geojson',)
# returns JSON object as a dictionary
data = json.load(f)
for feature in data['features']:
ml = float(feature['properties']['magnitude'])
h = float(feature['properties']['depth'])
Io = 1.5 * (ml - math.log(h) + 1.4)
for Iso in [i/10 for i in range(5,125,5)]:
a = (Io - Iso) / (1.8)
d = (10 / 8) * (a)
d = d - 1
if d <= 0:
print("Distance is zero")
else:
d = math.sqrt(h * h + d * d)
print("Radius (km) for " + str(Iso) + " MMI:", d)
CLICK HERE to find out more related problems solutions.