From 24cbf9efe52b62eca3f5458a6318e93e357c0867 Mon Sep 17 00:00:00 2001 From: ldam Date: Thu, 19 Sep 2024 10:28:40 -0600 Subject: [PATCH 1/2] add 'deprecated' tool as prefix for metadatatoph5 in validation.py --- ph5/clients/tests/test_ph5tostationxml.py | 8 ++++---- ph5/utilities/tests/test_ph5validate.py | 8 ++++---- ph5/utilities/tests/test_validation.py | 20 +++++++++++--------- ph5/utilities/validation.py | 20 +++++++++++--------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/ph5/clients/tests/test_ph5tostationxml.py b/ph5/clients/tests/test_ph5tostationxml.py index 66c982f4..340a1d8e 100644 --- a/ph5/clients/tests/test_ph5tostationxml.py +++ b/ph5/clients/tests/test_ph5tostationxml.py @@ -340,7 +340,7 @@ def test_get_response_inv(self): set([("array 003 station 0407, channel 1: Response_t[6]:" "response_file_das_a 'NoneQ330_NoneCMG3T_100LHN' is " "inconsistent with Array_t_003:das_model=rt125a. " - "Please check with metadatatoph5 format " + "Please check with deprecated tool metadatatoph5 format " "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha]).", 'error') ])) @@ -407,7 +407,7 @@ def test_create_obs_network(self): {"array 002 station 0407, channel 1: Response_t[5]:" "response_file_das_a 'NoneQ330_NoneCMG3T_200HHN' is " "inconsistent with Array_t_002:sensor_model=CMG. Please " - "check with metadatatoph5 format " + "check with deprecated tool metadatatoph5 format " "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha]).", "array 008 station 8001, channel 1: Response_t[1]:" @@ -452,8 +452,8 @@ def test_read_networks_no_resp_filename(self): self.assertEqual( contxt.exception.message, "Response table does not contain any response file names. " - "Check if resp_load has been run or if metadatatoph5 input " - "contained response information.") + "Check if resp_load has been run or if deprecated tool " + "metadatatoph5 input contained response information.") def test_read_networks_response_duplication(self): # response_t_dup_n_i.kef has n_i= 1,3,6 duplicated diff --git a/ph5/utilities/tests/test_ph5validate.py b/ph5/utilities/tests/test_ph5validate.py index d5b8bcab..b3ff8417 100755 --- a/ph5/utilities/tests/test_ph5validate.py +++ b/ph5/utilities/tests/test_ph5validate.py @@ -637,13 +637,13 @@ def test_check_response_t(self): self.assertEqual( ret[0].error, ["Response table does not contain any response file names. " - "Check if resp_load has been run or if metadatatoph5 input " - "contained response information."]) + "Check if resp_load has been run or if deprecated tool " + "metadatatoph5 input contained response information."]) self.assertEqual( log.records[0].msg, "Response table does not contain any response file names. " - "Check if resp_load has been run or if metadatatoph5 input " - "contained response information.") + "Check if resp_load has been run or if deprecated tool " + "metadatatoph5 input contained response information.") class TestPH5Validate_das_t_order(LogTestCase, TempDirTestCase): diff --git a/ph5/utilities/tests/test_validation.py b/ph5/utilities/tests/test_validation.py index 6c7acef2..7a0a689e 100644 --- a/ph5/utilities/tests/test_validation.py +++ b/ph5/utilities/tests/test_validation.py @@ -140,7 +140,8 @@ def test_check_metadatatoph5_format(self): err = ("array 002, station 0407, channel 1: Response_t[5]:" "response_file_das_a 'NoneQ330_CMG3T_200HHN' is inconsistent " "with Array_t_002:sensor_model=None CMG-3T. Please check with " - "metadatatoph5 format [das_model]_[sensor_model]_[sr][cha] " + "deprecated tool metadatatoph5 format " + "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha]).") with LogCapture() as log: log.setLevel(logging.ERROR) @@ -185,7 +186,7 @@ def test_check_metadatatoph5_format(self): '/Experiment_g/Responses_g/NoneQ330_NoneCMG3T' err = ("array 002, station 0407, channel 1: Response_t[5]:" "response_file_das_a 'NoneQ330_NoneCMG3T' is incomplete. " - "Please check with metadatatoph5 format " + "Please check with deprecated tool metadatatoph5 format " "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha])." ) @@ -259,8 +260,8 @@ def test_check_das_resp_load_format(self): "inconsistent with " "Array_t_002:sr=200 Array_t_002:sensor_model=None CMG-3T " "Array_t_002:srm=1. Please check with resp_load format " - "[das_model]_[sr]_[srm]_[gain] or metadatatoph5 format " - "[das_model]_[sensor_model]_[sr][cha] " + "[das_model]_[sr]_[srm]_[gain] or deprecated tool metadatatoph5" + " format [das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha]).") with LogCapture() as log: log.setLevel(logging.ERROR) @@ -282,8 +283,8 @@ def test_check_das_resp_load_format(self): "incomplete or inconsistent with Array_t_002:sr=200 " "Array_t_002:sensor_model=None CMG-3T. " "Please check with resp_load format " - "[das_model]_[sr]_[srm]_[gain] or metadatatoph5 format " - "[das_model]_[sensor_model]_[sr][cha] " + "[das_model]_[sr]_[srm]_[gain] or deprecated tool metadatatoph5" + " format [das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha]).") with LogCapture() as log: log.setLevel(logging.ERROR) @@ -420,8 +421,8 @@ def test_check_response_info(self): chckerrors = set( ["array 002 station 0407, channel 1: Response_t[5]:" "response_file_das_a 'NoneQ330_NoneCMG3T_200HHN' is inconsistent " - "with Array_t_002:das_model=Q330. Please check with " - "metadatatoph5 format [das_model]_[sensor_model]_[sr][cha] " + "with Array_t_002:das_model=Q330. Please check with deprecated " + "tool metadatatoph5 format [das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha])."]) with LogCapture() as log: log.setLevel(logging.WARNING) @@ -491,7 +492,8 @@ def test_check_has_response_filename(self): self.assertEqual(has_response_file, "Response table does not contain any response file " "names. Check if resp_load has been run or if " - "metadatatoph5 input contained response information.") + "deprecated tool metadatatoph5 input contained " + "response information.") class TestValidation_location(unittest.TestCase): diff --git a/ph5/utilities/validation.py b/ph5/utilities/validation.py index dedadcdb..714dc998 100644 --- a/ph5/utilities/validation.py +++ b/ph5/utilities/validation.py @@ -74,8 +74,8 @@ def check_metadatatoph5_format(Response_t, info, header, errors, logger): :return: if there are more than 3 parts return False if all (3) parts pass checks return True - if 2 parts pass checks, decide that this is created from metadatatoph5 - return True and log as error + if 2 parts pass checks, decide that this is created from deprecated + tool metadatatoph5 return True and log as error. if less than 2 parts pass checks return incomplete_errmsg, m_check_fail to be included if check for resp_load format also failed. """ @@ -113,7 +113,7 @@ def check_metadatatoph5_format(Response_t, info, header, errors, logger): if m_check_fail != set([]) or incomplete_errmsg != '': errmsg = combine_errors(m_check_fail, incomplete_errmsg, info) errmsg = ("{0}Response_t[{1}]:response_file_das_a '{2}' is {3}. " - "Please check with metadatatoph5 format " + "Please check with deprecated tool metadatatoph5 format " "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha])." ).format(header, @@ -148,8 +148,9 @@ def check_das_resp_load_format(Response_t, info, header, errors, logger, + if 3 parts corrects, decide this is created from resp_load so errmsg only includes resp_load's checks and format + if less than 3 parts corrects, cannot decide this is created from - resp_load or metadatatoph5, so errmsg includes resp_load's - checks and formats and metadatatoph5's if m_check_ret!=True + resp_load or deprecated tool metadatatoph5, so errmsg includes + resp_load's checks and formats and deprecated tool metadatatoph5's + if m_check_ret!=True """ if Response_t['response_file_das_a'] == '': # blank response_file_das_a return False in check_response_info @@ -158,7 +159,8 @@ def check_das_resp_load_format(Response_t, info, header, errors, logger, info['gain'] = Response_t['gain/value_i'] response_fname = Response_t['response_file_das_a'].split('/')[-1] r_format = "resp_load format [das_model]_[sr]_[srm]_[gain]" - m_format = ("metadatatoph5 format [das_model]_[sensor_model]_[sr][cha] " + m_format = ("deprecated tool metadatatoph5 format " + "[das_model]_[sensor_model]_[sr][cha] " "(check doesn't include [cha])") parts = response_fname.split('_') if len(parts) > 4: @@ -205,7 +207,7 @@ def check_das_resp_load_format(Response_t, info, header, errors, logger, r_format) else: # if less than 3 parts correct, include the check and format - # of checking metadatatoph5 format to error message + # of checking deprecated tool metadatatoph5 format to error message if incomplete_errmsg != 'incomplete': incomplete_errmsg = m_check_ret[0] for c in m_check_ret[1]: @@ -342,8 +344,8 @@ def check_has_response_filename(Response_t, errors, logger): if entry['response_file_das_a'] != '': return True errmsg = ("Response table does not contain any response file names. " - "Check if resp_load has been run or if metadatatoph5 input " - "contained response information.") + "Check if resp_load has been run or if deprecated tool " + "metadatatoph5 input contained response information.") addLog(errmsg, errors, logger) return errmsg From 156f9d3a0b7906b7524fb43f568b95db616e969d Mon Sep 17 00:00:00 2001 From: ldam Date: Thu, 19 Sep 2024 10:33:58 -0600 Subject: [PATCH 2/2] CHANGELOG --- CHANGELOG.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 4873fb60..c45fc7b3 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -55,6 +55,7 @@ ph5.clients.tests.test_ph5toms ph5.utilities.validation * keep common validation for both ph5tostationxml and ph5validate * Check for location errors and warnings + * Add 'deprecated tool' as prefix for metadatatoph5 when checking response ph5.clients.ph5tostationxml * Limit number of asynchronous processes * Remove storage format from the sxml channel level to be compatible with sxml version 1.1