Running out of memory: np.meshgrid Running out of memory: np.meshgrid numpy numpy

Running out of memory: np.meshgrid


This question may be obsolete now, but for other users, the problem here is that you are trying to make a mesh of 376704 points in each direction using np.meshgrid. The purpose of np.meshgrid is to take the x and y ranges and create a grid. For example:

x=np.arange(0,100) #1D arrayy=np.linspace(-50,50,1111) # 1D arrayxgrid,ygrid=np.meshgrid(x,y) #Outputs 2D arrays

Only use np.meshgrid if you want to grid your data. You can grid your data to lower resolution using a 3D interpolator such as RegularGridInterpolator and is one way to solve your problem and create your hill.

A quicker and better option in my opinion is using tricontourf. The function takes in the 1D arrays that you have to create the hill shading figure you desire. If you can't get this to work, update your question with a some data.