MemoryError: Unable to allocate array with shape (114671, 114671) and data type float64
See original GitHub issueI 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:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

That is really interesting! Thanks for sharing.
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,zfrom your latitudes and longitudes, and then kriging without thecoordinates_type='geographic'option. Maybe this saves just enough temporary arrays to fit into your RAM.Hope that helps!