Skip to content

ods_tools 5.0.1 does not support OED <3 #237

@carlfischerjba

Description

@carlfischerjba

Versions of OED <3 do not include their JSON spec as a release asset. This leads to the following error when trying to validate one of those files.

Traceback (most recent call last):
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/oed_schema.py", line 118, in from_oed_schema_info
    return cls.from_json(cls.DEFAULT_ODS_SCHEMA_PATH.format(oed_schema_info.lstrip('v')))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/oed_schema.py", line 140, in from_json
    with open(oed_json) as f:
         ^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '.../venv/lib/python3.12/site-packages/ods_tools/data/OpenExposureData_2.0.1Spec.json'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/oed_schema.py", line 121, in from_oed_schema_info
    return cls.from_json(oed_schema_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/oed_schema.py", line 140, in from_json
    with open(oed_json) as f:
         ^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '2.0.1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File ".../venv/bin/oasislmf", line 6, in <module>
    sys.exit(main())
             ^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/cli/root.py", line 54, in main
    sys.exit(RootCmd().run())
             ^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/cli/root.py", line 42, in run
    return super(OasisBaseCommand, self).run(args=args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/argparsetree/cmd.py", line 159, in run
    return cmd_cls(sub_command_name).run(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/argparsetree/cmd.py", line 159, in run
    return cmd_cls(sub_command_name).run(args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/argparsetree/cmd.py", line 161, in run
    return self.action(args) or 0
           ^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/cli/command.py", line 328, in action
    manager_method(**_kwargs)
  File ".../venv/lib/python3.12/site-packages/oasislmf/utils/log.py", line 123, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/manager.py", line 97, in interface
    return computation_cls(**kwargs).run()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/utils/log.py", line 123, in wrapper
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/computation/run/model.py", line 77, in run
    self.kwargs['exposure_data'] = get_exposure_data(self, add_internal_col=True)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/oasislmf/utils/data.py", line 880, in get_exposure_data
    exposure_data = OedExposure(**data_config)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/exposure.py", line 98, in __init__
    self.oed_schema = OedSchema.from_oed_schema_info(oed_schema_info)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../venv/lib/python3.12/site-packages/ods_tools/oed/oed_schema.py", line 123, in from_oed_schema_info
    raise ValueError(f"oed_schema_info {oed_schema_info} has no corresponding file or version")
ValueError: oed_schema_info 2.0.1 has no corresponding file or version

This is noted in the release notes for ods tools 5.0.0 and is somewhat better than #236 because the error is clearer, but it's not clear to the model vendor or user what should be done if they want to use this version of OED.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions