Skip to content

Documentation improvement #824

@Nemeth-B

Description

@Nemeth-B

In the online documentation - How to create surface example does not work any more:
https://mirageoscience-geoh5py.readthedocs-hosted.com/en/latest/content/user_guide/objects.html

It is hard to figure out how the surface.create wants the data presented.
Below is a short code that creates a simple surface with properties and demonstrates how to feed data to the surface.create method. Perhaps the documentation can be updated with something similar.

Thanks,

Balazs

import numpy as np

nodes=np.array([[0,0,0],[0,0,-20],[100,10,0],[100,10,-20]])
#/ index 0 1 2 3
#/ Array index is used in defining triangles

#/ This defines the order of the nodes how triangles are drawn,
#/ the numbers are the indexes of the node array elements
simplices=np.array([[0,1,2],[1,2,3]])

from geoh5py import Workspace as g5W
from geoh5py.objects import Surface as g5S

Wsps=g5W.create("rectangle.geoh5")
surface = g5S.create(
Wsps,
vertices=nodes,
cells=simplices,
name="Rectangle",
property_groups='Seismic'

)

vertex_data_values = np.array([200.,100.,300.,400.])
SF_data=surface.add_data(
{
# Dictionary of
"Velocity": { # Name of the data property
"association": "VERTEX", # Data associated with vertices
"values": vertex_data_values,
"units": 'm/s'
}
}
)

Wsps.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions