def test_variogram(): """Test the return types""" # get data df = data.pancake() hydrobox.plotting_backend('plotly') for t, type_ in zip(('object', 'describe', 'plot'), (skg.Variogram, dict, go.Figure)): vario = hydrobox.geostat.variogram( df[['x', 'y']].values, df.z.values, return_type=t ) assert isinstance(vario, type_)
def test_gridsearch(): """Test Gridsearch with explicit param_grid""" # create the grid param_grid={'model': ('spherical', 'gaussian', 'stable')} # get data df = data.pancake() gs = hydrobox.geostat.gridsearch( param_grid=param_grid, coordinates=df[['x', 'y']].values, values=df.z.values, n_lags=25, return_type='object' ) assert isinstance(gs, GridSearchCV)
def test_gridsearch_variogram(): """Test Gridsearch with variogram passed""" df = data.pancake() # create the grid param_grid={'fit_method': ('trf', 'lm', 'ml')} vario = hydrobox.geostat.variogram( df[['x', 'y']].values, df.z.values, n_lags=15, return_type='object' ) gs = hydrobox.geostat.gridsearch( param_grid, variogram=vario, return_type='best_param' ) assert isinstance(gs, dict)
plots. These plots help to understand the spatial properties of a variogram, and finally, the :class:`Variogram <skgstat.Variogram>` object itself can be returned and used in one of the Kriging routines. """ from pprint import pprint import plotly import hydrobox from hydrobox.data import pancake from hydrobox.plotting import plotting_backend plotting_backend('plotly') # %% # Load sample data from the data sub-module df = pancake() # %% # Estimate a variogram using a exponential model and 25 distance lags # that are derived from a KMeans cluster algorithm # Here, we use the describe output option to get a dictionary of # all variogram parameters vario = hydrobox.geostat.variogram(coordinates=df[['x', 'y']].values, values=df.z.values, model='exponential', bin_func='kmeans', n_lags=25, return_type='describe') # print pprint(vario)