meshio
meshio copied to clipboard
[BUG] meshio CLI fails to read Abaqus .inp file
Describe the bug
Runing the command meshio info file.inp --input-format abaqus
fails with the following error:
Traceback (most recent call last):
File "C:\Users\jeffr\anaconda3\envs\meshing\Scripts\meshio-script.py", line 9, in <module>
sys.exit(main())
^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\_cli\_main.py", line 52, in main
return args.func(args)
^^^^^^^^^^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\_cli\_info.py", line 21, in info
mesh = read(args.infile, file_format=args.input_format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\_helpers.py", line 71, in read
return _read_file(Path(filename), file_format)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\_helpers.py", line 103, in _read_file
return reader_map[file_format](str(path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\abaqus\_abaqus.py", line 106, in read
out = read_buffer(f)
^^^^^^^^^^^^^^
File "C:\Users\jeffr\anaconda3\envs\meshing\Lib\site-packages\meshio\abaqus\_abaqus.py", line 154, in read_buffer
[point_ids[point_id] for point_id in set_ids], dtype="int32"
~~~~~~~~~^^^^^^^^^^
KeyError: 18879
What I can tell you is that this node definitely exists, and is definitely in the .inp file.
To Reproduce I cannot provide the Abaqus file because of NDAs. I can provide information about it on request.
Diagnose
Result of pip freeze
:
cached-property @ file:///home/conda/feedstock_root/build_artifacts/cached_property_1615209429212/work
certifi==2023.7.22
cftime @ file:///D:/bld/cftime_1695561165733/work
h5py @ file:///D:/bld/h5py_1696887557548/work
importlib-metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1688754491823/work
markdown-it-py @ file:///home/conda/feedstock_root/build_artifacts/markdown-it-py_1686175045316/work
mdurl @ file:///home/conda/feedstock_root/build_artifacts/mdurl_1639515908913/work
meshio @ file:///home/conda/feedstock_root/build_artifacts/meshio_1647016219543/work
netCDF4 @ file:///D:/bld/netcdf4_1695582999283/work
numpy @ file:///D:/bld/numpy_1695291098581/work/dist/numpy-1.26.0-cp312-cp312-win_amd64.whl#sha256=fccd6a2dbc6f610b16ca87fd9a2092bb1a29083ce039c65bb69aa98f8a45b096
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1691408637400/work
rich @ file:///home/conda/feedstock_root/build_artifacts/rich-split_1696096668362/work/dist
setuptools==68.0.0
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1695040754690/work
wheel==0.37.1
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1695255097490/work
I figured out the source of the issue. The Abaqus parser doesn't support multiple node blocks as it's currently written. I might try to write a quick fix and make a pull request.
Okay I was able to fix it locally. I'll clone the latest repo and make a pull request