Skip to content

Replace geomagio/Metadata.py & Poetry Update

The goal of this MR is to move away from using instrument calibrations that are stored in an in-repo .py file and instead use the new instrument metadata (see !290 (merged)) from the database to generate the calibrations. The changes in this MR are closely related to or depend on the changes in !290 (merged) (@awernle) and vice-versa.

Overview of changes:

  • Move get_instrument function from the temporary file geomagio/Metadata.py to geomagio/metadata/instrument/InstrumentCalibrations.py.
  • Rename get_instrument function to get_instrument_calibrations to avoid confusion with instrument metadata.
  • Change functionality of get_instrument_calibrations so that it pulls instrument metadata via get_metadata then processes it into calibration data using InstrumentCalibrations.
  • InstrumentCalibrations is a new class that compiles a list of instrument calibrations from a list of instrument metadata objects. The output elements use the same format that Metadata/get_instrument previously provided so changes to Miniseedfactory and tests are minimal.

Potential things to consider/discuss:

  • get_instrument_calibrations does not currently have a failover method for providing calibrations if it doesn't have a connection to the database. If we lost that connection, then we just get errors and an empty list.
  • get_instrument_calibrations appears to be called by MiniSeedFactory every time we filter data and for every channel (@erigler, @swilbur does this seem correct?). We may also want to consider having MiniSeedFactory send the name of the channel that it is looking for calibrations on so that get_instrument_calibrations can handle it efficiently.
  • We will have to watch out for any processing issues that may be caused by delays from network latency or database performance issues.

NOTE: The default url is currently pointed at the staging database for testing. This should be updated in a future MR to point at production!

During testing our version of Cryptography started getting flagged by Audit so the poetry lock file had to be updated.

Edited by Geels, Brendan Ryan

Merge request reports