Geodels / gospl

Global Scalable Paleo Landscape Evolution Model
https://gospl.readthedocs.io
GNU General Public License v3.0
64 stars 11 forks source link

error running bfModel.ipynb within definegtin function #92

Closed johnjarmitage closed 3 years ago

johnjarmitage commented 3 years ago

Hi @tristan-salles, I am testing your notebook example bfModel.ipynb as part of the review process for JOSS. I have installed gospl using mamba (its a wee bit faster, and developed locally here in Paris):

mamba env create -f conda-env.yml
mamba install jupyterlab

and then,

mamba install -c conda-forge pyvista
pip install stripy

The notebook however falls over with an error on the second cell:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-4e10a22dcc17> in <module>
     30 a = np.sort(Gmesh.idx_hierarchy.reshape(s[0], -1).T)
     31 Gmesh.edges = {"nodes": np.unique(a, axis=0)}
---> 32 ngbNbs, ngbID = definegtin(len(coords), Gmesh.cells['nodes'], 
     33                            Gmesh.edges['nodes'])
     34 

KeyError: 'nodes'

Do you have any ideas what is causing this error? I am probably missing a dependency, I guess.

tristan-salles commented 3 years ago

Hi @johnjarmitage,

This is an issue with the meshplex most recent version which was released on the 6/11 :-) The fix is easy, change the "nodes" to "points" and it should work:


Gmesh.edges = {"points": np.unique(a, axis=0)}
ngbNbs, ngbID = definegtin(len(coords), Gmesh.cells['points'], 
                           Gmesh.edges['points'])

I will update the example accordingly!


if meshplex.__version__>= "0.1.14":
    Gmesh.edges = {"points": np.unique(a, axis=0)}
    ngbNbs, ngbID = definegtin(len(coords), Gmesh.cells['points'], 
                               Gmesh.edges['points'])
else:
    Gmesh.edges = {"nodes": np.unique(a, axis=0)}
    ngbNbs, ngbID = definegtin(len(coords), Gmesh.cells['nodes'], 
                               Gmesh.edges['nodes'])

Thanks Tristan

johnjarmitage commented 3 years ago

Hi Tristan,

Unfortunately this update to meshplex creates issues further down the line within gospl. I get errors from unstructuredmesh.py when launching the code, which I fixed locally by changing "nodes" to "points" on lines 143 to 145 within unstructuredmesh.py. Hopefully that is the only spot where further modification is necessary.

Bonne journée, John

johnjarmitage commented 3 years ago

The notebook ran with this modification and the output looks very nice. You can close this issue from my end.

tristan-salles commented 3 years ago

Missed the unstructuredmesh.py mesh one! Thanks for pointing it to me. I have updated the code accordingly. I will close the issue.