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

geoplot.semivariogram from example gives error #10

Open
sathyanarayanrao opened this issue May 14, 2018 · 0 comments
Open

geoplot.semivariogram from example gives error #10

sathyanarayanrao opened this issue May 14, 2018 · 0 comments

Comments

@sathyanarayanrao
Copy link

sathyanarayanrao commented May 14, 2018

Hello C Johnson,

I came across your interesting software today and immediately tried to run few examples. I followed the example from
http://nbviewer.jupyter.org/github/cjohnson318/geostatsmodels/blob/master/notebooks/VariogramAnalysis.ipynb

and my code is

import numpy as np
from pandas import DataFrame, Series
from geostatsmodels import utilities, kriging, variograms, model, geoplot
import matplotlib.pyplot as plt
from scipy.stats import norm


z = open('ZoneA.dat','r' ).readlines()
z = [ i.strip().split() for i in z[10:] ]
z = np.array( z, dtype=np.float )
z = DataFrame( z, columns=['x','y','thk','por','perm','lperm','lpermp','lpermr'] )
P = np.array( z[['x','y','por']] )

fig, ax = plt.subplots()
fig.set_size_inches(8,8)
cmap = geoplot.YPcmap
ax.scatter( z.x/1000, z.y/1000, c=z.por, s=64,cmap=cmap)
ax.set_aspect(1)
plt.xlim(-2,22)
plt.ylim(-2,17.5)

plt.xlabel('Easting [m]')
plt.ylabel('Northing [m]')
th=plt.title('Porosity %')

tolerance = 1000
lags = np.arange( tolerance, 10000, tolerance*2 )
sill = np.var(P[:,2])

pw = utilities.pairwise(P)
geoplot.hscattergram(P,pw,1000,500)

tolerance = 250
lags = np.arange( tolerance, 10000, tolerance*2 )
sill = np.var(P[:,2])

geoplot.semivariogram( P, lags, tolerance )

I use the same data as in the example. However, I am unable to get a plot of semivariogram and instead I get

Traceback (most recent call last):

  File "<ipython-input-51-b20e0e8f00c3>", line 1, in <module>
    runfile('C:/PYTHON/geostatistics/geo1.py', wdir='C:/PYTHON/geostatistics')

  File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Anaconda\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/PYTHON/geostatistics/geo1.py", line 37, in <module>
    geoplot.semivariogram( P, lags, tolerance )

  File "C:\Anaconda\lib\site-packages\geostatsmodels\geoplot.py", line 82, in semivariogram
    h, sv = variograms.semivariogram( data, lags, tol )

TypeError: iteration over a 0-d array

Can you please help me to get over this issue ?

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

1 participant