Commit f9701830 authored by Peter Evans's avatar Peter Evans
Browse files

import_fdsnws_eq: Return depths in km, not metres

parent c4365e84
...@@ -105,6 +105,9 @@ def fetch_origin(root, ns, preferredoriginID): ...@@ -105,6 +105,9 @@ def fetch_origin(root, ns, preferredoriginID):
d[tag] = float(v) d[tag] = float(v)
except ValueError: except ValueError:
pass pass
# QuakeML depths are in metres.
d["depth"] = d["depth"] / 1000.0
return d return d
......
...@@ -24,10 +24,15 @@ class QuakeMLReadTestCase(unittest.TestCase): ...@@ -24,10 +24,15 @@ class QuakeMLReadTestCase(unittest.TestCase):
outfile = "data/testoutput.yaml" outfile = "data/testoutput.yaml"
def test_read_good_file(self): def test_read_good_file(self):
"""
This GEOFON event has a focal mechanism, and a depth of 34 km.
Check that a value in km, not metres, is produced.
"""
infile = "data/gfz2021ekhv.xml" infile = "data/gfz2021ekhv.xml"
result = fetch_quakeml(infile) result = fetch_quakeml(infile)
self.assertTrue(isinstance(result, dict)) self.assertTrue(isinstance(result, dict))
self.assertEqual(result["id"], "gfz2021ekhv") self.assertEqual(result["id"], "gfz2021ekhv")
self.assertLess(result["origin"]["depth"], 100.0)
def test_read_good_eventid(self): def test_read_good_eventid(self):
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment