We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'str' object has no attribute 'isValid'
I used the default yml files here: https://github.com/cmarshak/DSWX-SAR/tree/main/src/dswx_sar/defaults
yml
As illustrated in this notebook, I run something to the effect:
from dswx_sar.dswx_runconfig import RunConfig, WORKFLOW_SCRIPTS_DIR from dataclasses import dataclass run_config_path = <RUNCONFIG_PATH> @dataclass class Args: """placeholder""" debug_mode = False log_file = log_path cfg = RunConfig.load_from_yaml(str(run_config_path), 'dswx_s1', args)
I get:
Validation fail for algorithm_parameter_s1 runconfig yaml /Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1A_IW_SLC__1SDV_20240108T232450_20240108T232517_052022_06495E_2EAD/params.yml. --------------------------------------------------------------------------- YamaleError Traceback (most recent call last) File ~/bekaert-team/DSWX-SAR/src/dswx_sar/dswx_runconfig.py:114, in load_validate_yaml(yaml_path, workflow_name) 113 try: --> 114 yamale.validate(schema, data) 115 except yamale.YamaleError as yamale_err: File ~/mambaforge/envs/dswx_s1/lib/python3.11/site-packages/yamale/yamale.py:43, in validate(schema, data, strict, _raise_error) 42 if _raise_error and not is_valid: ---> 43 raise YamaleError(results) 44 return results YamaleError: Error validating data '/Users/cmarshak/bekaert-team/dswx-sar-workflow-pst/out/S1A_IW_SLC__1SDV_20240108T232450_20240108T232517_052022_06495E_2EAD/params.yml' with schema '/Users/cmarshak/bekaert-team/DSWX-SAR/src/dswx_sar/schemas/algorithm_parameter_s1.yaml' runconfig.processing.initial_threshold.selection_method: 'combined' is not a list. During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) Cell In[16], line 1 ----> 1 cfg = RunConfig.load_from_yaml(str(run_config_path), 'dswx_s1', args) File ~/bekaert-team/DSWX-SAR/src/dswx_sar/dswx_runconfig.py:399, in RunConfig.load_from_yaml(cls, yaml_path, workflow_name, args) 396 sensor = product.split('_')[-1] 397 ancillary = sns.dynamic_ancillary_file_group --> 399 algorithm_cfg = load_validate_yaml(ancillary.algorithm_parameters, 400 f'algorithm_parameter_{sensor.lower()}') 402 # Check if input files have the requested polarizations and 403 # sort the order of the polarizations. 404 input_dir_list = \ 405 cfg['runconfig']['groups']['input_file_group']['input_file_path'] File ~/bekaert-team/DSWX-SAR/src/dswx_sar/dswx_runconfig.py:118, in load_validate_yaml(yaml_path, workflow_name) 116 err_str = f'Validation fail for {workflow_name} runconfig yaml {yaml_path}.' 117 logger.error(err_str) --> 118 raise yamale.YamaleError(err_str) from yamale_err 120 # load default runconfig 121 parser = YAML(typ='safe') File ~/mambaforge/envs/dswx_s1/lib/python3.11/site-packages/yamale/yamale_error.py:3, in YamaleError.__init__(self, results) 2 def __init__(self, results): ----> 3 super(YamaleError, self).__init__('\n'.join([str(x) for x in list(filter(lambda x: not x.isValid(), results))])) 4 self.message = self.args[0] 5 self.results = results File ~/mambaforge/envs/dswx_s1/lib/python3.11/site-packages/yamale/yamale_error.py:3, in YamaleError.__init__.<locals>.<lambda>(x) 2 def __init__(self, results): ----> 3 super(YamaleError, self).__init__('\n'.join([str(x) for x in list(filter(lambda x: not x.isValid(), results))])) 4 self.message = self.args[0] 5 self.results = results AttributeError: 'str' object has no attribute 'isValid'
The issue is here: https://github.com/cmarshak/DSWX-SAR/blob/main/src/dswx_sar/defaults/algorithm_parameter_s1.yaml#L58
Note the schema says it should be a list: https://github.com/cmarshak/DSWX-SAR/blob/main/src/dswx_sar/schemas/algorithm_parameter_s1.yaml#L52
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
I used the default
yml
files here: https://github.com/cmarshak/DSWX-SAR/tree/main/src/dswx_sar/defaultsAs illustrated in this notebook, I run something to the effect:
I get:
The issue is here: https://github.com/cmarshak/DSWX-SAR/blob/main/src/dswx_sar/defaults/algorithm_parameter_s1.yaml#L58
Note the schema says it should be a list: https://github.com/cmarshak/DSWX-SAR/blob/main/src/dswx_sar/schemas/algorithm_parameter_s1.yaml#L52
The text was updated successfully, but these errors were encountered: