0

Hi i tried to run the kriging code from pykrige. However, during running the code there is an error. Here is the code. p/s I am new to python

**os.chdir("E:\\18_Jupyter")
os.getcwd()
pip install pykrige
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from pykrige.uk import UniversalKriging
sss = pd.read_csv('try1.csv')
sss.head()
x = sss.iloc[:,0]
y = sss.iloc[:,1]
z = sss.iloc[:,2]
gridx = np.arange(0,14,0.125)
gridy = np.arange(95,126,0.125)
UK = UniversalKriging(
    x,
    y,
    z,
variogram_model="linear",
drift_terms=["regional_linear"],
)

here is the error

**MemoryError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_23672\3274456448.py in <module>
----> 1 UK = UniversalKriging(
  2     x,
  3     y,
  4     z,
  5     variogram_model="linear",

MemoryError: Unable to allocate 7.59 GiB for an array with shape (1018651816,) and data
type float64**
zam
  • 3
  • 3
  • How much RAM do you have available? – slothrop Apr 04 '23 at 14:39
  • Your operation requires more RAM than you have. Either you give it more RAM (by freeing some up or installing more), or you work with less data. – Klaus D. Apr 04 '23 at 14:40
  • 8.00 GB RAM, 6.94GB usable. Is it possible that I can use any portable hardisk for the processing ? – zam Apr 04 '23 at 15:19
  • In principle, numpy allows this with `memmap`: https://stackoverflow.com/questions/16149803/working-with-big-data-in-python-and-numpy-not-enough-ram-how-to-save-partial-r. However, since this array is being created by a function of a third-party library and you're not calling numpy from your own code to create it, you might be limited in what you can do. – slothrop Apr 04 '23 at 15:22

0 Answers0