Skip to main content

Variogram

GitHub source

Variogram

evo.objects.typed.variogram.Variogram

A GeoscienceObject representing a variogram.

The variogram describes the spatial correlation structure of a variable, used in geostatistical modeling and kriging interpolation.

sill

sill: Annotated[float, SchemaLocation('sill')]

The variance of the variogram.

is_rotation_fixed

is_rotation_fixed: Annotated[bool, SchemaLocation('is_rotation_fixed')]

Boolean value specifying whether all structure's rotations are the same.

structures

structures: Annotated[list[dict[str, Any]], SchemaLocation('structures')]

List of variogram structures (exponential, gaussian, spherical, etc.).

nugget

nugget: Annotated[float, SchemaLocation('nugget')] = 0.0

The variance between two samples separated by near-zero lag distance.

data_variance

data_variance: Annotated[float | None, SchemaLocation('data_variance')]

The variance of the data, used for normalising or rescaling the variogram.

modelling_space

modelling_space: Annotated[Literal['data', 'normalscore'] | None, SchemaLocation('modelling_space')]

The modelling space the variogram model was fitted in.

domain

domain: Annotated[str | None, SchemaLocation('domain')]

The domain the variogram is modelled for.

attribute

attribute: Annotated[str | None, SchemaLocation('attribute')]

The attribute the variogram is modelled for.

get_ellipsoid

get_ellipsoid(structure_index: int | None = None) -> 'Ellipsoid'

Get an Ellipsoid from a variogram structure for visualization or search.

Returns an Ellipsoid from evo.objects.typed that can be used for: - 3D visualization with surface_points() or wireframe_points() - Creating search ellipsoids via scaled() - Kriging search neighborhoods

Args: structure_index: Index of the structure to use. If None (default), selects the structure with the largest volume (major × semi_major × minor).

Returns: Ellipsoid configured with the structure's anisotropy ranges and rotation.

Example: >>> # Get ellipsoid from structure with largest range (default) >>> var_ell = variogram.get_ellipsoid() >>> >>> # Or explicitly select a structure by index >>> var_ell = variogram.get_ellipsoid(structure_index=0) >>> >>> # Create search ellipsoid scaled by 2x >>> search_ell = var_ell.scaled(2.0) >>> >>> # Visualize with Plotly >>> x, y, z = var_ell.surface_points(center=(100, 200, 50)) >>> mesh = go.Mesh3d(x=x, y=y, z=z, alphahull=0, opacity=0.3)

get_principal_directions

get_principal_directions(
max_distance: float | None = None, n_points: int = 200
) -> tuple["VariogramCurveData", "VariogramCurveData", "VariogramCurveData"]

Generate variogram curve data for the three principal directions.

Calculates the variogram model along the major, semi-major, and minor axis directions. Each direction uses the corresponding range from the anisotropy ellipsoid.

Args: max_distance: Maximum distance for the curves. If None, uses 1.2x the maximum range. n_points: Number of points for smooth curves.

Returns: Tuple of (major_curve, semi_major_curve, minor_curve) as VariogramCurveData.

Example with Plotly: >>> major, semi_maj, minor = variogram.get_principal_directions() >>> import plotly.graph_objects as go >>> fig = go.Figure() >>> fig.add_trace(go.Scatter(x=minor.distance, y=minor.semivariance, ... name='Minor', line=dict(color='blue'))) >>> fig.add_trace(go.Scatter(x=semi_maj.distance, y=semi_maj.semivariance, ... name='Semi-major', line=dict(color='green'))) >>> fig.add_trace(go.Scatter(x=major.distance, y=major.semivariance, ... name='Major', line=dict(color='red'))) >>> fig.update_layout(xaxis_title='Distance', yaxis_title='Semivariance') >>> fig.show()

get_direction

get_direction(
azimuth: float, dip: float, max_distance: float | None = None, n_points: int = 200
) -> tuple["NDArray[np.floating[Any]]", "NDArray[np.floating[Any]]"]

Calculate variogram model curve in an arbitrary direction.

Computes the variogram semivariance along a specified direction defined by azimuth and dip angles. The effective range in that direction is calculated using the anisotropic transform.

Args: azimuth: Azimuth angle in degrees (0-360), measured clockwise from north. dip: Dip angle in degrees (-90 to 90), positive downward. max_distance: Maximum distance for the curve. If None, uses 1.3x the effective range in the specified direction. n_points: Number of points for smooth curve.

Returns: Tuple of (distance, semivariance) as numpy arrays, suitable for plotting.

Example with Plotly: >>> distance, semivariance = variogram.get_direction(azimuth=45, dip=30) >>> import plotly.graph_objects as go >>> fig = go.Figure() >>> fig.add_trace(go.Scatter(x=distance, y=semivariance, name='Az=45°, Dip=30°')) >>> fig.update_layout(xaxis_title='Distance', yaxis_title='Semivariance') >>> fig.show()

Example with Matplotlib: >>> distance, semivariance = variogram.get_direction(azimuth=0, dip=0) >>> import matplotlib.pyplot as plt >>> plt.plot(distance, semivariance) >>> plt.xlabel('Distance') >>> plt.ylabel('Semivariance') >>> plt.show()

What is the reason for your feedback?