python - getting a list of coordinates from a 2D matrix -
let's have 10 x 20 matrix of values (so 200 data points) values = np.random.rand(10,20) with known regular spacing between coordinates x , y coordinates defined by coord_x = np.arange(0,5,0.5) --> gives [0.0,0.5,1.0,1.5...4.5] coord_y = np.arange(0,5,0.25) --> gives [0.0,0.25,0.50,0.75...4.5] i'd array representing each coordinates points shape of array (200,2), 200 being total number of points , dimension representing x , y such as coord[0][0]=0.0, coord[0][1]=0.0 coord[1][0]=0.0, coord[1][1]=0.25 coord[2][0]=0.0, coord[2][1]=0.50 ... coord[19][0]=0.0, coord[19][1]=5.0 coord[20][0]=0.5, coord[20][1]=0.0 coord[21][0]=0.5, coord[21][1]=0.25 coord[22][0]=0.5, coord[22][1]=0.50 ... coord[199][0]=4.5, coord[199][1]=4.5 that easy thing double loop, wonder if there more elegant solution using built-in numpy (or else) functions. ? i think meant coord_y = np.arange(0,5,0.25) in question. can do from numpy import meshgrid,column_stack x,y=meshgrid(co...