Skip to content

Error when reading wall IDS from DD version 3.42.0 into 4.1.0 #89

Description

@timothy-nunn

IMAS-Python version: 2.1.0
System: Mac M1
Python: 3.10.17

I am getting the following error when reading an IMAS database (DD version 3.24.0 via the netcdf backend) and converting the wall IDS to DD version 4.1.0:

Traceback (most recent call last):
  File "/Users/timothynunn/eqdsk/imas_test.py", line 39, in <module>
    wall_ids = convert_ids(db.get("wall"), NEW_DD_VERSION)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 513, in convert_ids
    _copy_structure(toplevel, target, deepcopy, rename_map)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 634, in _copy_structure
    _copy_structure(item[i], target_item[i], deepcopy, rename_map, callback)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 636, in _copy_structure
    _copy_structure(item, target_item, deepcopy, rename_map, callback)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 634, in _copy_structure
    _copy_structure(item[i], target_item[i], deepcopy, rename_map, callback)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 624, in _copy_structure
    new_items = rename_map.type_change[path](item, target_item)
  File "/Users/timothynunn/eqdsk/.venv/lib/python3.10/site-packages/imas/ids_convert.py", line 843, in _repeat_first_point_conditional
    closed = bool(closed_node)
TypeError: __bool__ should return bool, returned numpy.bool

I have created the following small script to showcase how to replicate the error:

import numpy as np
from imas import DBEntry, IDSFactory, convert_ids


ORIGINAL_DD_VERSION = "3.42.0"
NEW_DD_VERSION = "4.1.0"

with DBEntry("test.nc", "w", dd_version=ORIGINAL_DD_VERSION) as db:
    # Create the IDS factor with a fixed version of the DD (4.1.0)
    # because the following code uses that API
    ids_factory = IDSFactory(version=NEW_DD_VERSION)

    limiter_ids = ids_factory.wall()
    description_2d = limiter_ids.description_2d
    description_2d.resize(1)
    description_2d = description_2d[0]
    unit = description_2d.limiter.unit
    unit.resize(1)
    unit = unit[0]
    outline = unit.outline

    limiter_ids.ids_properties.homogeneous_time = 1
    outline.r = np.array([0.0, 0.0, 1.0, 1.0])
    outline.z = np.array([0.0, 1.0, 1.0, 0.0])

    # Convert the IDS back to 3.42.0 before writing because this is the version
    # of the DBEntry.
    db.put(convert_ids(limiter_ids, ORIGINAL_DD_VERSION))


with DBEntry("test.nc", "r", dd_version=ORIGINAL_DD_VERSION) as db:
    print(f"=== Opening database with DD version {ORIGINAL_DD_VERSION} ===")
    wall_ids = db.get("wall")
    limiter = wall_ids.description_2d[0].limiter.unit[0].outline
    print(f"Limiter r = {limiter.r.value}")
    print(f"Limiter z = {limiter.z.value}")


with DBEntry("test.nc", "r", dd_version=ORIGINAL_DD_VERSION) as db:
    print(
        f"=== Opening database with DD version {ORIGINAL_DD_VERSION}, converting to {NEW_DD_VERSION} ==="
    )
    # the error occurs at this line, when trying to convert the 3.42.0 wall IDS to 4.1.0
    wall_ids = convert_ids(db.get("wall"), NEW_DD_VERSION)
    limiter = wall_ids.description_2d[0].limiter.unit[0].outline
    print(f"Limiter r = {limiter.r.value}")
    print(f"Limiter z = {limiter.z.value}")

Activity

  1. self-assigned this
    on Dec 17, 2025
  2. maarten-ic commented on Dec 17, 2025

    @maarten-ic
    Collaborator

    Hi @timothy-nunn,

    Thanks for the clear and short reproduction scenario! The issue is in the logic that reads 0D data from a netCDF file: I'm preparing a fix now.

  3. added a commit that references this issue on Dec 17, 2025
    860cc83
  4. added a commit that references this issue on Jan 5, 2026
    9c56a3e
  5. timothy-nunn commented on Jan 20, 2026

    @timothy-nunn
    Author

    Dear @maarten-ic. Thank you again for your quick implementation of a fix for this bug, it is much appreciated. Do you know when the next release of IMAS-Python is planned so that we can pin to a version that includes this fix?

    Many thanks,
    Tim

  6. olivhoenen commented on Jan 20, 2026

    @olivhoenen
    Collaborator

    Next release (2.2.0) may happen next week or as soon as #20 is merged in develop.

  7. added a commit that references this issue on Feb 12, 2026
    678a7e5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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