nschloe / meshio

:spider_web: input/output for many mesh formats
MIT License
1.96k stars 402 forks source link

[BUG] Tecplot reader fails on VARLOCATION #1368

Open tcaduser opened 2 years ago

tcaduser commented 2 years ago

Describe the bug

When trying to convert a Tecplot formatted file, it fails on parsing the VARLOCATION data:

$ meshio convert gmsh_mos2d_dd.tec  test.e
Traceback (most recent call last):
  File "/home/juan/miniconda3/envs/devsim_test/bin/meshio", line 8, in <module>
    sys.exit(main())
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/_cli/_main.py", line 52, in main
    return args.func(args)
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/_cli/_convert.py", line 53, in convert
    mesh = read(args.infile, file_format=args.input_format)
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/_helpers.py", line 71, in read
    return _read_file(Path(filename), file_format)
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/_helpers.py", line 103, in _read_file
    return reader_map[file_format](str(path))
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/tecplot/_tecplot.py", line 103, in read
    out = read_buffer(f)
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/tecplot/_tecplot.py", line 177, in read_buffer
    ) = _parse_fezone(zone, variables)
  File "/home/juan/miniconda3/envs/devsim_test/lib/python3.9/site-packages/meshio/tecplot/_tecplot.py", line 344, in _parse_fezone
    varrange, varloc = location.split("=")
ValueError: not enough values to unpack (expected 2, got 1)

The problematic line is most likely 1 of:

ZONE T="bulk" NODES=2249, ELEMENTS=4255, DATAPACKING=BLOCK, ZONETYPE=FETRIANGLE, VARLOCATION=([155,156,157,158,159,160,161,162]=CELLCENTERED)
ZONE T="gate" NODES=39, ELEMENTS=57, DATAPACKING=BLOCK, ZONETYPE=FETRIANGLE, VARLOCATION=([155,156,157,158,159,160,161,162]=CELLCENTERED)
ZONE T="oxide" NODES=666, ELEMENTS=1207, DATAPACKING=BLOCK, ZONETYPE=FETRIANGLE, VARLOCATION=([155,156,157,158,159,160,161,162]=CELLCENTERED)

To Reproduce A minimal code example that reproduces the problem would be a big help if you can provide it. Attach a small mesh file if necessary.

Mesh file attached.

Diagnose I may ask you to cut and paste the output of the following command.

pip freeze | grep meshio
meshio==5.3.4

Did I help?

If I was able to resolve your problem, consider sponsoring my work on meshio, or buy me a coffee to say thanks.

tcaduser commented 2 years ago

test.zip