natural_fields_lib\natural_fields\mt\util\mth5_helpers.py:300: in pack_runts_into_mth5
run_group.from_runts(runts) # FIXME: this is the slow line
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\groups\run.py:663: in from_runts
ch = getattr(run_ts_obj, comp)
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\run_ts.py:487: in __getattr__
return ChannelTS(
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:133: in __init__
self.ts = data
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:735: in ts
self._update_xarray_metadata()
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:804: in _update_xarray_metadata
self.channel_metadata.time_period.start = self.start.iso_no_tz
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:573: in channel_metadata
ch_metadata.sample_rate = self.sample_rate
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:932: in sample_rate
self._sample_rate = self.compute_sample_rate()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[NameError("name 'scipy' is not defined") raised in repr()] ChannelTS object at 0x2526559dab0>
def compute_sample_rate(self):
"""
Two cases, high_frequency (HF) data and not HF data.
# Original comment about the HF case:
Taking the median(diff(timestamps)) is more accurate for high sample rates, the way pandas.date_range
rounds nanoseconds is not consistent between samples, therefore taking the median provides better results
if the time series is long this can be inefficient so test first
"""
if self.is_high_frequency():
dt_array = np.diff(self.data_array.coords.indexes["time"])
> best_dt, counts = scipy.stats.mode(dt_array)
E NameError: name 'scipy' is not defined
C:\Users\DIASdeployment\miniforge3\envs\qamt_testing\lib\site-packages\mth5\timeseries\channel_ts.py:913: NameError
imports at top of script
# -*- coding: utf-8 -*-
"""
.. module:: timeseries
:synopsis: Deal with MT time series
.. todo:: Check the conversion to netcdf. There are some weird serializations of
lists and arrays that goes on, seems easiest to convert all lists to strings and then
convert them back if read in.
:copyright:
Jared Peacock (jpeacock@usgs.gov)
:license:
MIT
"""
# ==============================================================================
# Imports
# ==============================================================================
import inspect
import numpy as np
import pandas as pd
import xarray as xr
from loguru import logger
from scipy import signal
import mt_metadata.timeseries as metadata
from mt_metadata.timeseries.filters import ChannelResponse
from mt_metadata.utils.mttime import MTime
from mt_metadata.utils.list_dict import ListDict
from mth5.utils import fdsn_tools
from mth5.timeseries.ts_filters import RemoveInstrumentResponse
from mth5.timeseries.ts_helpers import (
make_dt_coordinates,
get_decimation_sample_rates,
)
from obspy.core import Trace
# =============================================================================
# make a dictionary of available metadata classes
# =============================================================================
meta_classes = dict(inspect.getmembers(metadata, inspect.isclass))
# ==============================================================================
Windows Server 2022 Standard
Error from action runner, mth5 version 0.4.9:
imports at top of script