gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
384 stars 137 forks source link

colab and /tmp #750

Open mariosgeo opened 4 months ago

mariosgeo commented 4 months ago

Problem description

/tmp mesh files are not found

Your environment

Please provide the output of print(pygimli.Report()) here. If that does not work, please give provide some additional information on your:

Operating system: e.g. Colab Python version: 3.10, pyGIMLi version: 1.5.1 Way of installation: pip.

from pygimli.physics import ert
import pygimli as pg
import pygimli.meshtools as mt

data=ert.load('trial4.pyg')
plc = mt.createParaMeshPLC3D(data, paraDepth=-1, paraMaxCellSize=00.0,
                             surfaceMeshQuality=34)
mesh = mt.createMesh(plc, quality=1.3)

...

Expected behavior

Make a mesh

Actual behavior

I think the tempfile directory is different in colab and local installs. Is there any flag we can save the tempfiles to e.g. googledrive install of /tmp?. The mesh is created when run locally.

[/usr/local/lib/python3.10/dist-packages/pygimli/meshtools/mesh.py](https://localhost:8080/#) in readTetgen(fName, comment, verbose, defaultCellMarker, loadFaces, quadratic)
    961 
    962     # Part 1/3: Nodes, essential
--> 963     with open(fName + '.node', 'r') as node_in:
    964         node_lines = pg.utils.filterLinesByCommentStr(node_in.readlines(),
    965                                                       comment)

FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpqu_t6iw8-1.node'
mariosgeo commented 4 months ago

follow up. The .poly files are on the /tmp folder. Not the .node ones

halbmy commented 4 months ago

It seems like instead of the command-line based tetgen the installed pacakge is a wrapper for connecting pyVista: https://pypi.org/project/tetgen/

halbmy commented 4 months ago

We would have to change things to work with that. However, I am not sure about potential licensing issues as tetgen was always kind of restrictive.

halbmy commented 1 week ago

Sorry for the late response. We could of course allow a keyword argument with a (e.g. local) filename taken instead of the default tmpfile as a workaround.

mary-tsekhmistrenko commented 6 days ago

I get the same error message for the example script plot_05_refraction_3D.ipynb, but I am not using Colab. Is there a quick workaround we can do ourselves for this?

Here is my environment information: OS : Darwin (macOS 14.2.1) CPU(s) : 12 Machine : arm64 Architecture : 64bit RAM : 16.0 GiB Environment : Jupyter File system : apfs

Python 3.11.9 packaged by conda-forge pygimli : 1.5.0 pgcore : 1.5.0 numpy : 1.26.4 matplotlib : 3.7.3 scipy : 1.14.1 IPython : 8.26.0 pyvista : 0.44.1

halbmy commented 5 days ago

you should be able to set the environment variable TMPDIR to a place where you have writing rights