Skip to content

imas convert for a selected list of IDSs #144

Closed

Description

@iderf

A useful option for imas convert would be to convert a specific list of IDSs. Converting all IDSs can be time consuming (and might fail for some IDSs which are not needed). Selecting only one by --ids IDS is not useful if more than one is needed in one folder.

Activity

  1. olivhoenen commented on Oct 23, 2026

    @olivhoenen
    Collaborator

    We can look at this indeed.
    Not that in the meantime you can do that already using IDStools's idscp with the --dd-update and selecting the target DD version with IMAS_VERSION, it will use the same convert_ids function from IMAS-Python. E.g. :

    IMAS_VERSION=4.1.1 idscp -s imas:hdf5?path=/work/imas/shared/imasdb/ITER/3/134174/117 -d test.nc --dd-update core_profiles equilibrium summary
    
  2. Shakhtar-Sankur commented on Nov 11, 2026

    @Shakhtar-Sankur
    Contributor

    Hi @olivhoenen, I'd like to work on this if nobody else is. My proposal is to let --ids take more than one IDS, either repeated or comma-separated, since imas convert has a single --ids option today:

    imas convert <uri_in> 4.1.1 <uri_out> --ids core_profiles,equilibrium,summary
    imas convert <uri_in> 4.1.1 <uri_out> --ids core_profiles --ids equilibrium
    

    Leaving --ids out would still convert every IDS, and --occurrence would apply to each IDS in the list. I'd check every name against the target DD before converting, so a typo fails at the start rather than halfway through, and add tests in test_cli.py.

    Would that work for you? If so, could you assign this to me?

  3. olivhoenen commented on Nov 12, 2026

    @olivhoenen
    Collaborator

    Sure @Shakhtar-Sankur, please go on. IMO allowing a list of IDS to the --ids option will be better for users than repeating --ids option.

  4. maarten-ic commented on Nov 13, 2026

    @maarten-ic
    Collaborator

    While working on this: should this also support cases where you'd want to copy multiple occurrences from an IDS?

    E.g. if the source IDS has IDSs summary, plasma_profiles, plasma_profiles/1, plasma_profiles/2, you might want to convert summary and plasma_profiles 1 and 2 together, which the new solution doesn't allow.

    Perhaps we should deprecate the --occurrence argument (and remove at next major release) and allow IDS+occurrence in the --ids argument? For example

    imas convert <in> <dd_version> <out> --ids summary,plasma_profiles:1,plasma_profiles:2
    
  5. olivhoenen commented on Nov 13, 2026

    @olivhoenen
    Collaborator

    Indeed; the --occurrence does was making sense only together with a single IDS selected by --ids. @Shakhtar-Sankur would you mind updating your PR to incorporate @maarten-ic 's suggestion?

  6. Shakhtar-Sankur commented on Nov 13, 2026

    @Shakhtar-Sankur
    Contributor

    Done in #152: --ids now takes IDS or IDS:OCCURRENCE, for example --ids summary,plasma_profiles:1,plasma_profiles:2, and an IDS without an occurrence converts all of its occurrences. --occurrence still works for IDSs given without one, but now logs a deprecation warning pointing to the new syntax, so it can be removed at the next major release. A malformed occurrence (core_profiles:x) is rejected before anything is written. Tests cover the new syntax, the deprecated option and invalid occurrences; the full suite passes (1804 passed, 297 skipped): https://www.kaggle.com/code/sankurkundu/notebook9f482fecaf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions