From 38ff917409bb55cdebff89eca3e5858948a7cb72 Mon Sep 17 00:00:00 2001 From: Calum Chamberlain Date: Wed, 31 Jan 2024 14:58:16 +1300 Subject: [PATCH 1/3] Raise useful error when waveform_id is incomplete See #563 - some picks from FDSN services are missing channel codes resulting in an opaque and hard to understand error. --- eqcorrscan/core/template_gen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eqcorrscan/core/template_gen.py b/eqcorrscan/core/template_gen.py index 7f361497c..fe75e75b5 100644 --- a/eqcorrscan/core/template_gen.py +++ b/eqcorrscan/core/template_gen.py @@ -521,6 +521,10 @@ def _download_from_client(client, client_type, catalog, data_pad, process_len, "Pick not associated with waveforms, will not use:" " {0}".format(pick)) continue + if pick.waveform_id.channel_code is None: + Logger.error(f"Missing waveform_id.channel_code for Pick {pick}.") + raise TemplateGenError( + "Ensure that all picks have complete waveform_id attributes") if all_channels: channel_code = pick.waveform_id.channel_code[0:2] + "?" else: From f7794bd8295809022e9dc9aab76396ff34946100 Mon Sep 17 00:00:00 2001 From: Calum Chamberlain Date: Wed, 26 Jun 2024 18:13:24 +1200 Subject: [PATCH 2/3] linter --- eqcorrscan/core/template_gen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eqcorrscan/core/template_gen.py b/eqcorrscan/core/template_gen.py index fe75e75b5..4b246fda4 100644 --- a/eqcorrscan/core/template_gen.py +++ b/eqcorrscan/core/template_gen.py @@ -524,7 +524,8 @@ def _download_from_client(client, client_type, catalog, data_pad, process_len, if pick.waveform_id.channel_code is None: Logger.error(f"Missing waveform_id.channel_code for Pick {pick}.") raise TemplateGenError( - "Ensure that all picks have complete waveform_id attributes") + "Ensure that all picks have complete " + "waveform_id attributes") if all_channels: channel_code = pick.waveform_id.channel_code[0:2] + "?" else: From ae55bb434154c4cbdb2f1fd67a3d9cf72f6c027c Mon Sep 17 00:00:00 2001 From: Calum Chamberlain Date: Sat, 29 Jun 2024 08:30:37 +1200 Subject: [PATCH 3/3] linter --- eqcorrscan/core/template_gen.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eqcorrscan/core/template_gen.py b/eqcorrscan/core/template_gen.py index 4b246fda4..dc7007f33 100644 --- a/eqcorrscan/core/template_gen.py +++ b/eqcorrscan/core/template_gen.py @@ -522,7 +522,8 @@ def _download_from_client(client, client_type, catalog, data_pad, process_len, " {0}".format(pick)) continue if pick.waveform_id.channel_code is None: - Logger.error(f"Missing waveform_id.channel_code for Pick {pick}.") + Logger.error( + f"Missing waveform_id.channel_code for Pick {pick}.") raise TemplateGenError( "Ensure that all picks have complete " "waveform_id attributes")