User Forum of Software BASEMENT

BASEMENT
Basic Simulation Environment for computation of environmental flow and natural hazard simulation
Laboratory of Hydraulics, Hydrology and Glaciology (VAW)
ETH Zurich
Basement_Logo

You are not logged in.

#1 2024-02-07 22:50:53

ClaireGilder
User
From: Missoula, Montana, US
Registered: 2023-11-19
Posts: 4

Help using basemesh API for Segments and Mesh Interpolation

I am working to create a model that needs me to regenerate my meshes occasionally, and for efficiency's sake, this needs to happen in Python, not using a GUI in QGIS. I am using BASEMENT 4.02 and am familiar with the basemesh GUI and workflow in QGIS. However, I am new to using meshes rather than rasters in Python and I am having difficulties mapping the workflow in the GUI to workflow in Python.

I am struggling to understand Segment objects in basemesh. Are these equivalent to breaklines in the GUI? If I have a list of tuples of xyz coordinates across my model domain, including the xyz vertices of the breaklines as they would appear in QGIS, does each breakline become a Segment object using basemesh.triangle.Segment? If yes, then I have gotten basemesh.elevation_mesh(nodes, segments, keep_convex_hull = True) to create the elevation mesh object I need to now interpolate. Can I visualize the .node, .ele., or .poly files to check my work? If no, how do breaklines and Segment objects relate to each other and how do I generate the elevation mesh with a set of xyz points and breaklines?

Once I have created the elevation mesh object, and move to interpolating the mesh (I assume this is equivalent to generating the quality mesh and the computational mesh in one step rather than two like the GUI), I am getting an error on the very first line mesh = basemesh.Mesh.open(Elevation_Mesh) where Elevation_Mesh is the Mesh object created by basemesh.elevation_mesh. I get the message "TypeError: expected str, bytes or os.PathLike object, not Mesh"

If anyone has some example code they could point me towards, or has a few minutes to help me find additional documentation to learn this more methodically, I would really appreciate the assistance!

Offline

Board footer

Powered by FluxBB