Skip to content

Commit 0a770ae

Browse files
committed
Update process_aurora.py
1 parent 78c6483 commit 0a770ae

File tree

1 file changed

+11
-36
lines changed

1 file changed

+11
-36
lines changed

mtpy/processing/aurora/process_aurora.py

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -139,30 +139,9 @@ def create_config(
139139
)
140140
return config
141141
else:
142-
if (
143-
self.local_mth5_path is not None
144-
and self.local_station_id is not None
145-
):
146-
self._initialize_kernel_dataset()
147-
cc = ConfigCreator()
148-
config = cc.create_from_kernel_dataset(self, **kwargs)
149-
if self.sample_rate > 1000:
150-
decimation_kwargs.update(
151-
self.default_window_parameters["high"]
152-
)
153-
else:
154-
decimation_kwargs.update(
155-
self.default_window_parameters["low"]
156-
)
157-
self._set_decimation_level_parameters(
158-
config, **decimation_kwargs
159-
)
160-
return config
161-
162-
else:
163-
raise ValueError(
164-
"Cannot make config because KernelDataset has not been set yet."
165-
)
142+
raise ValueError(
143+
"Cannot make config because KernelDataset has not been set yet."
144+
)
166145
else:
167146
cc = ConfigCreator()
168147
config = cc.create_from_kernel_dataset(kernel_dataset, **kwargs)
@@ -203,7 +182,10 @@ def _initialize_kernel_dataset(self, sample_rate=None):
203182
if sample_rate is not None:
204183
run_summary = self.run_summary.set_sample_rate(sample_rate)
205184
else:
206-
run_summary = self.run_summary.clone()
185+
# have to use a single sample rate otherwise an error is thrown.
186+
run_summary = self.run_summary.set_sample_rate(
187+
self.run_summary.df.sample_rate.unique()[0]
188+
)
207189

208190
self.from_run_summary(run_summary)
209191

@@ -213,7 +195,6 @@ def create_kernel_dataset(
213195
local_station_id=None,
214196
remote_station_id=None,
215197
sample_rate=None,
216-
inplace=False,
217198
):
218199
"""
219200
This can be a stane alone method and return a kds, or create in place
@@ -227,14 +208,8 @@ def create_kernel_dataset(
227208
if sample_rate is not None:
228209
run_summary = self.run_summary.set_sample_rate(sample_rate)
229210

230-
if inplace:
231-
self.from_run_summary(run_summary)
232-
else:
233-
kernel_dataset = KernelDataset()
234-
kernel_dataset.from_run_summary(
235-
run_summary, local_station_id, remote_station_id
236-
)
237-
return kernel_dataset
211+
self.from_run_summary(run_summary)
212+
return self.clone()
238213

239214
def process_single_sample_rate(
240215
self, sample_rate, config=None, kernel_dataset=None
@@ -254,15 +229,15 @@ def process_single_sample_rate(
254229
sample_rate=sample_rate,
255230
)
256231
if config is None:
257-
config = self.create_config()
232+
config = self.create_config(kernel_dataset=kernel_dataset)
258233

259234
try:
260235
tf_obj = process_mth5(config, kernel_dataset)
261236
except Exception as error:
262237
close_open_files()
263238
logger.exception(error)
264239
logger.error(f"Skipping sample_rate {sample_rate}")
265-
return None
240+
return
266241

267242
tf_obj.tf_id = self.processing_id
268243
mt_obj = MT(survey_metadata=tf_obj.survey_metadata)

0 commit comments

Comments
 (0)