Error reading OPL files which does not contain "filename" attribute
from majis import read_opl
opl_fname = '/Users/nmanaud/workspace/majis/juice_preops/PLANNING/SCENARIOS/S011_01_TR03_331122_331220/TIMELINE/OPL_SOC_S011_01_S02P00.json'
read_opl(opl_fname)
produces this error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[4], line 3
1 from majis import read_opl
2 opl_fname = '/Users/nmanaud/workspace/majis/juice_preops/PLANNING/SCENARIOS/S011_01_TR03_331122_331220/TIMELINE/OPL_SOC_S011_01_S02P00.json'
----> 3 read_opl(opl_fname)
File /opt/miniconda3/envs/mos_ops_env/lib/python3.12/site-packages/majis/opl/reader.py:36, in read_opl(fname, flat, only)
34 events = read_opl_csv(f)
35 case '.json':
---> 36 events = read_opl_json(f, only=only)
37 case _:
38 raise ValueError(f'Invalid OPL file input: {fname}')
File /opt/miniconda3/envs/mos_ops_env/lib/python3.12/site-packages/majis/opl/reader.py:92, in read_opl_json(fname, only)
77 def read_opl_json(
78 fname: str | Path,
79 only: str | list | bool | None = 'MAJIS',
80 ) -> list[EventWindow]:
81 """Read OPL file in JSON format.
82
83 Note
(...) 90
91 """
---> 92 return read_itl_json(fname, fmt='OPL', only=only)
File /opt/miniconda3/envs/mos_ops_env/lib/python3.12/site-packages/majis/itl/json/reader.py:32, in read_itl_json(fname, fmt, only)
29 schema.validate(content)
31 # Check filename match the one in the file
---> 32 filename = Path(content['header']['filename'])
33 if not filename or filename.name != Path(fname).name:
34 raise FileNotFoundError(filename)
KeyError: 'filename'