Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]Export issues #188

Open
fjphhxx opened this issue Mar 15, 2024 · 12 comments
Open

[Question]Export issues #188

fjphhxx opened this issue Mar 15, 2024 · 12 comments

Comments

@fjphhxx
Copy link

fjphhxx commented Mar 15, 2024

Hi,
I would like to ask how to export the model into a file. When I tried to use exporters.py for exporting, various errors occurred. I would appreciate it if you could help me resolve my doubts.
Thank you.

@lachlangrose
Copy link
Member

Hi, currently there is no exporting available. You can use the visualisation class and export the triangles and nodes for the surfaces.

In the future there will be direct import for various surface formats.

@rolandhill
Copy link

Hi,

Along the same lines, I'm trying to use write_feat_surfs() from exporters.py. I get the warning
"For {featurename} isovalue {isovalue} doesn't exist inside bounding box, skipping"

from here:

if isovalue > np.nanmax(val) or isovalue < np.nanmin(val):
        logger.warning(
            f"For {featurename} isovalue {isovalue} doesn't exist inside bounding box, skipping"
        )
        return False, []

Going back a few lines, the error appears to stem from model.bounding_box, which only contains zeros.

When bounding_box is initialised in GeologicalModel it looks to go from 0 to the width/height of the model bounds, rather than from the origin to the maximum. I tried setting the bounding_box to go from origin to maximum, but it threw a bunch of other errors - I'm not sure of the intent of bounding_box.

It looks like most of the code to export features to file (and to get the vertex/face etc arrays for integration into other code) is already there.

BTW, I've just started looking into Loop3D. It looks great - thank you for your work and making it open source. Lots to learn!

Regards,
Roland

@lachlangrose
Copy link
Member

Hi @rolandhill,

The code you are trying to use from the exporter module is not up to date, it was code that was added into LoopStructral to be able to export the loopstructural models/surfaces into other software. It hasn't been in my workflow and there were no tests so it needs some refactoring.

In the next release which I am currently working on I have made an abstract type for surfaces, scalar fields and data objects from LoopStructural. The idea is that these types will be able to be exported to various formats e.g. vtk, obj, geoh5, gocad, json etc. I will update this issue when the version is working.

Cheers,

Lachlan

@rolandhill
Copy link

Thanks, Lachlan. I'm looking forward to the next release.

Will this also include access to the vertex, face, normal etc arrays to pull geometry directly into other applications?

Cheers,
Roland

@lachlangrose
Copy link
Member

Yes. The current data structure for surfaces is here.

There will be a similar structure for points, grids and vector fields. So it should be easy to convert into other applications.

@fjphhxx
Copy link
Author

fjphhxx commented Jun 7, 2024

Hi,
When using the function write_feat_surfs(model=model, featurename, file_format, file_name), UNIT how these geologic units are output. Or what should be the featurename to output the unit.
image
Regards,
fjp

@lachlangrose
Copy link
Member

Hi, @fjphhxx please use the newest version of LoopStructural and export the surfaces using the

for s in model[featurename].surfaces([isovalue1,isovalue2]):
  s.save('surface.vtk')

You can export surfaces in gocad tsurf .ts, mira's geoscience analyst .geoh5, json, obj, vtk, or pickle the python object. The save function will interpret the file type from the extension you choose.

or you can write your own exporter using the surface datatype using surface.vertices and surface.triangles

@rolandhill the Surface, ValuePoints, VectorPoints and StructuredGrid datatypes should also be of interest to you.

@fjphhxx
Copy link
Author

fjphhxx commented Jun 7, 2024

Thanks, Lachlan.
Awesome, I'm going to try it. But now I have a problem, how do I upgrade the loop to version 1.6.

@lachlangrose
Copy link
Member

lachlangrose commented Jun 7, 2024 via email

@fjphhxx
Copy link
Author

fjphhxx commented Jun 11, 2024

Thank you. I've upgraded successfully. But there are some problems when using it, such as AttributeError: 'Loop3DView' object has no attribute 'interactive'. Is the Interactive function no longer available?

@rolandhill
Copy link

rolandhill commented Jun 11, 2024 via email

@lachlangrose
Copy link
Member

Hi @fjphhxx,

Loop3DView is not the same as the lavavu visualisation. The Loop3DView wraps the pyvista Plotter class, so you will need to adjust any visualisation code.

view.show() will display the plot using an interactive widget if you have a compatible installation of pyvista (use the loopstructuralvisualisation[jupyter] package to install this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants