Skip to content

Missing case in conversion 3.42-->4 #55

Open
@olivhoenen

Description

@olivhoenen

Raised by Dmitriy Yadykin in https://jira.iter.org/browse/IMAS-5795?focusedId=2644629&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-2644629

Issue is _tor --> _phi renaming was listed as NBC but not a destructive change because it affects active IDSs (_tor fields were kept in 3.42.0 and subsequent DD versions). So if an IDS is created directly in v3.42.0, with a _tor field, this is not converted into _phi, and we loose this info when _tor disappear in v4.

If the IDS was created in v3.41 or older, then the NBC transformation applies (whether we convert to 3.42 or 4.0 does not matter, what matters is to cross the 3.42 version).

Not sure what is the best way to fix this: dd4 specific rule or a change of the normal NBC transformation in such special case?

This stub shows the problem

import imas
from imas.ids_convert import convert_ids

fact341 = imas.IDSFactory("3.41.0")
fact342 = imas.IDSFactory("3.42.0")

eq341 = fact341.equilibrium()
eq341.ids_properties.homogeneous_time=1
eq341.time = [0.0]
eq341.time_slice.resize(1)
eq341.time_slice[0].profiles_1d.j_tor = [0.3,0.2,0.1]
eq341.time_slice[0].profiles_1d.psi = [1.,0.5,0.]

eq342 = fact342.equilibrium()
eq342.ids_properties.homogeneous_time=1
eq342.time = [0.0]
eq342.time_slice.resize(1)
eq342.time_slice[0].profiles_1d.j_tor = [0.3,0.2,0.1]
eq342.time_slice[0].profiles_1d.psi = [1.,0.5,0.]

eq4from341 = convert_ids(eq341,"4.0.0")
print(f"3.41.0 --> 4.0.0: j_phi={eq4from341.time_slice[0].profiles_1d.j_phi.value}")

eq4from342 = convert_ids(eq342,"4.0.0")
print(f"3.42.0 --> 4.0.0: j_phi={eq4from342.time_slice[0].profiles_1d.j_phi.value}")

eq342from341 = convert_ids(eq341,"3.42.0")
print(f"3.41.0 --> 3.42.0: j_phi={eq342from341.time_slice[0].profiles_1d.j_phi.value}")

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions