Skip to content
Snippets Groups Projects
Commit 86e257d3 authored by Geels, Brendan Ryan's avatar Geels, Brendan Ryan :tophat:
Browse files

Exclude invalid entries in get_instrument_calibrations

parent f10f33f3
No related branches found
No related tags found
1 merge request!306Replace geomagio/Metadata.py & Poetry Update
......@@ -2,6 +2,8 @@ from obspy import UTCDateTime
from geomagio.metadata import Metadata, MetadataFactory, MetadataCategory
# REMOVE ANY INSTRUMENT METADATA ELEMENTS W/ "DATA_VALID=FALSE"
class InstrumentCalibrations:
"""
......@@ -305,7 +307,8 @@ def get_instrument_calibrations(
observatory: observatory code
start_time: start time to match, or None to match any.
end_time: end time to match, or None to match any.
calibrations: use custom list, defaults to pulling and converting metadata
calibrations: use custom list, defaults to pulling and converting instrument metadata
metadata_url: metadata database url
Returns:
list of applicable instrument calibrations
"""
......@@ -321,6 +324,12 @@ def get_instrument_calibrations(
station=observatory,
)
metadata = factory.get_metadata(query=query)
# remove invalid metadata entries
for i, m in enumerate(metadata):
if not m.data_valid:
metadata.pop(i)
instrumentCalibrations = InstrumentCalibrations(metadata)
calibrations = instrumentCalibrations.get_calibrations()
......
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