Closed jbakosi closed 4 years ago
Please let me know what I'm doing wrong.
You're using the same meshio version as Galileo Galilei. Just upgrade and it'll work.
Okay, I'll install a custom one and try that one. This is what I pulled in from debian stable: https://packages.debian.org/search?keywords=meshio&searchon=names&suite=stable§ion=all
I'd use pip install meshio
.
On debian stable pip install meshio
still gives me
meshio 2.3.10 [Python 2.7.16]
Copyright (c) 2015-2019 Nico Schlömer <nico.schloemer@gmail.com>
which still does not detect ugrid correctly. I'm no python guru, how else should I install it?
Probably pip3 install meshio
. Python 2.7 has not been supported by meshio
for quite a while now.
Thanks @keurfonluu . Now I get:
$ pip3 install meshio
Collecting meshio
Downloading https://files.pythonhosted.org/packages/12/0e/44d6af1480791676d375f3c3e8ef5d40521a2529fddb180fef401ff414d0/meshio-4.0.2-py3-none-any.whl (125kB)
100% |████████████████████████████████| 133kB 1.1MB/s
Collecting numpy (from meshio)
Downloading https://files.pythonhosted.org/packages/63/0c/0261693cc3ad8e2b66e66dc2d2676a2cc17d3efb1c58a70db73754320e47/numpy-1.18.1-cp37-cp37m-manylinux1_x86_64.whl (20.1MB)
100% |████████████████████████████████| 20.1MB 97kB/s
Installing collected packages: numpy, meshio
Successfully installed meshio-4.0.2 numpy-1.18.1
$ meshio-convert
Traceback (most recent call last):
File "/usr/local/bin/meshio-convert", line 6, in <module>
from meshio._cli import convert
ModuleNotFoundError: No module named 'meshio._cli'
Did it not pull some dependency?
Well, my guess is that your previous Python 2 installation is messing with meshio-convert
.
Try pip uninstall meshio
and then reinstall with pip3
.
It's also weird that it installs in /usr/local/
. It should really be $HOME/.local
. What's your pip version? You might want to update this to pip 20 first (pip install pip --user
should do).
Okay, thanks for the help. I think this is progress, but not quite there yet.
$ pip3 install meshio
Collecting meshio
Downloading https://files.pythonhosted.org/packages/12/0e/44d6af1480791676d375f3c3e8ef5d40521a2529fddb180fef401ff414d0/meshio-4.0.2-py3-none-any.whl (125kB)
100% |████████████████████████████████| 133kB 1.2MB/s
Collecting numpy (from meshio)
Downloading https://files.pythonhosted.org/packages/63/0c/0261693cc3ad8e2b66e66dc2d2676a2cc17d3efb1c58a70db73754320e47/numpy-1.18.1-cp37-cp37m-manylinux1_x86_64.whl (20.1MB)
100% |████████████████████████████████| 20.1MB 94kB/s
Installing collected packages: numpy, meshio
The scripts f2py, f2py3 and f2py3.7 are installed in '/home/jbakosi/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The scripts meshio-ascii, meshio-binary, meshio-compress, meshio-convert, meshio-decompress and meshio-info are installed in '/home/jbakosi/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed meshio-4.0.2 numpy-1.18.1
$ ~/.local/bin/meshio-convert sphere_tetra.1.ugrid sphere_tetra.1.exo
Traceback (most recent call last):
File "/home/jbakosi/.local/bin/meshio-convert", line 10, in <module>
sys.exit(convert())
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_cli/_convert.py", line 35, in convert
write(args.outfile, mesh, **kwargs)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 117, in write
file_format = _filetype_from_path(path)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 33, in _filetype_from_path
raise ReadError("Could not deduce file format from extension '{}'.".format(ext))
meshio._exceptions.ReadError: Could not deduce file format from extension '.1.exo'.
jbakosi@euler:~/code/etc/ugrid$ ~/.local/bin/meshio-convert sphere_tetra.1.ugrid sphere_tetra.exo
Traceback (most recent call last):
File "/home/jbakosi/.local/bin/meshio-convert", line 10, in <module>
sys.exit(convert())
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_cli/_convert.py", line 35, in convert
write(args.outfile, mesh, **kwargs)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 117, in write
file_format = _filetype_from_path(path)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 33, in _filetype_from_path
raise ReadError("Could not deduce file format from extension '{}'.".format(ext))
meshio._exceptions.ReadError: Could not deduce file format from extension '.exo'.
How do I tell meshio that I want exodus output?
Aha! Use .e
, but .exo
should actually work as well.
$ ~/.local/bin/meshio-convert sphere_tetra.1.ugrid sphere_tetra.e
Traceback (most recent call last):
File "/home/jbakosi/.local/bin/meshio-convert", line 10, in <module>
sys.exit(convert())
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_cli/_convert.py", line 35, in convert
write(args.outfile, mesh, **kwargs)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 117, in write
file_format = _filetype_from_path(path)
File "/home/jbakosi/.local/lib/python3.7/site-packages/meshio/_helpers.py", line 33, in _filetype_from_path
raise ReadError("Could not deduce file format from extension '{}'.".format(ext))
meshio._exceptions.ReadError: Could not deduce file format from extension '.e'.
Ah, right. You need netCDF4
installed, otherwise meshio can't do nothing.
Cool. Should I just pull it in using apt-get or pip or some other recommended way so meshio finds it?
netCDF4
itself has more dependencies, so I usually use apt
.
Uh! Success! Thanks a lot for the help. I did apt-get install python3-netcdf4
to make netcdf4 available in python3.
One minor note: The ugrid -> exodus conversion took over the node coordinates, and the triangle and tetrahedron connectivities, but did not create side sets.
Yeah, node sets aren't supported yet; I think there's an open issue for it. If not, feel free to open a new one.
Yeah, I figured. This is already very useful, though, since side sets and node sets to exo files can be added with another tool, e.g., cubit.
I'm having trouble detecting ugrid for the file attached. Here is what I'm doing:
I also tried renaming the file to
sphere_tetra.ugrid
, but that produces the same problem.sphere_tetra.1.ugrid.txt Rename to
sphere_tetra.1.ugrid
Please let me know what I'm doing wrong. Thanks.