diff --git a/omas/omas_structure.py b/omas/omas_structure.py index a01d0061..415fc82e 100644 --- a/omas/omas_structure.py +++ b/omas/omas_structure.py @@ -588,6 +588,7 @@ def add_extra_structures(extra_structures, lifecycle_status='tmp'): # reset structure caches omas_utils._structures = {} omas_utils._structures_dict = {} + omas_utils._ods_structure_cache = {} # add _structures for _ids in extra_structures: diff --git a/omas/tests/test_omas_core.py b/omas/tests/test_omas_core.py index b97294b7..85cc00a6 100755 --- a/omas/tests/test_omas_core.py +++ b/omas/tests/test_omas_core.py @@ -577,6 +577,27 @@ def test_relax(self): assert ods1['core_profiles.profiles_1d.0.ion.0.element[0].z_n'] == 1.5 assert ods1['equilibrium.time_slice[0].profiles_2d[0].psi'][0, 1] == 1.5 + def test_add_extra_structures(self): + from omas.omas_structure import add_extra_structures, imas_structure + + original = imas_structure("3.39.0", "wall.description_2d.0.limiter.unit.0") + extension = { + "wall": { + "wall.description_2d[:].limiter.unit[:].test_field": { + "data_type": "STR_0D", + "documentation": "Test field Name", + "full_path": "wall/description_2d(i1)/limiter/unit(i2)/test_field", + "type": "static", + } + } + } + add_extra_structures(extension) + extended = imas_structure("3.39.0", "wall.description_2d.0.limiter.unit.0") + + assert 'test_field' not in original + assert 'test_field' in extended + + # End of TestOmasCore class