Skip to content

Adding scalar whose name lenght greater than 32 causes error, #312

@daviddanan

Description

@daviddanan

Describe the bug
Hello, i am trying to use plaid to handle mesh-based dataset within my company and i encountered an obscure bug. After i narrowed it down, i find out the issue was related to the length of the scalar name.

Step to Reproduce the issue

from plaid import Sample

sample = Sample()
scalars = [33*"e"]
for scalar in scalars:
    sample.add_scalar(scalar, 0)

print(sample.features.get_global_names())

This gives

828             for path in global_paths:
829                 if "Time" not in path:
--> [830]plaid/src/plaid/containers/features.py:830)                     global_names.append(CGU.getNodeByPath(base_node, path)[0])
831 return global_names

TypeError: 'NoneType' object is not subscriptable

By replacing 33 with 32, the bug disappear.

Expected behavior
Even if such a bug is not trivial to fix, i expect to have a proper error handling to understand why such thing happen. Right now, it was necessary to dig much deeper to understand the root cause.

Desktop (please complete the following information):
I am using the current development version of Plaid with windows 11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions