Skip to content
Snippets Groups Projects
Commit a4bc6d95 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler
Browse files

print nothing if sensor_sampling_rate is not invertable

The _format_headers() function in IAGA2002Writer.py would choke when
the sensor_sampling_rate parameter in the trace.stats metadata could
not be inverted. This occurred, at least, when the "Digital Sampling"
IAGA2002 header line was not parsed properly, or was blank.
parent 283b0c64
No related branches found
No related tags found
1 merge request!214Minor factory fixes applied in March 2023
......@@ -87,11 +87,15 @@ class IAGA2002Writer(object):
self._format_header("Sensor Orientation", stats.sensor_orientation)
)
if "sensor_sampling_rate" in stats:
buf.append(
self._format_header(
"Digital Sampling", str(1 / stats.sensor_sampling_rate) + " second"
try:
buf.append(
self._format_header(
"Digital Sampling",
str(1 / stats.sensor_sampling_rate) + " second",
)
)
)
except TypeError:
buf.append(self._format_header("Digital Sampling", ""))
if "data_interval_type" in stats:
buf.append(
self._format_header("Data Interval Type", stats.data_interval_type)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment