question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MemoryError: Unable to allocate array with shape (114671, 114671) and data type float64

See original GitHub issue

I get the following error: MemoryError: Unable to allocate array with shape (114671, 114671) and data type float64

Defining Ordinary Kriging as:

gridx = np.arange(min_x, max_x, 1)
gridy = np.arange(min_y, max_y, 1)

# Ordinary Kriging
OK = OrdinaryKriging(x, y, z, variogram_model='exponential',
                       verbose=False, enable_plotting=True, coordinates_type='geographic')

z1, ss = OK.execute('grid', gridx, gridy)

Where, min_x = 8084396 min_y = 12073405 max_x = 8084864 max_y = 12073894

I understand that grid_x and grid_y arrays are too big. What can I do in this case to make this work?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MuellerSebcommented, Sep 21, 2020

That is really interesting! Thanks for sharing.

1reaction
mjziebarthcommented, Sep 17, 2020

To chime in, having written that part of the code:

That part of the code is a fairly simple implementation of the third equation of the section Computational formulas of this Wikipedia article. It was written using a simple vectorized version of the equation which creates a number of temporary arrays corresponding to terms of the rather large equation.

If you are working so tightly at your RAM limit, these additional terms could be the icing on the cake. Apart from random subsampling, you could try to work in Euclidean space (see #149), if you don’t explicitly want to use the great-circle distance at large distances. Specifically, this would mean to compute Euclidean coordinates x,y,z from your latitudes and longitudes, and then kriging without the coordinates_type='geographic' option. Maybe this saves just enough temporary arrays to fit into your RAM.

Hope that helps!

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Unable to allocate array with shape and data type
I've read somewhere that np. zeros shouldn't be really allocating the whole memory needed for the array, but only for the non-zero elements....
Read more >
Out of Memory Error: MemoryError: Unable to allocate array ...
"MemoryError: Unable to allocate 25.5 GiB for an array with shape (58548, 58548) and data type float64 " This is my error please...
Read more >
Big array and MemoryError: Unable to allocate memory (in ...
However, now I am running into the error MemoryError: Unable to allocate 185. GiB for an array with shape (157673, 157673) and data...
Read more >
Unable to allocate array with shape and data type - Cluzters.ai
I'm facing an issue with allocating huge arrays in numpy on Ubuntu 18 while not facing the same issue on MacOS. I am...
Read more >
How i can fix this problem for python jupyter" Unable to ...
How i can fix this problem for python jupyter" Unable to allocate 10.4 GiB for an array with shape (50000, 223369) and data...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found