Skip to content Skip to sidebar Skip to footer

Find (i,j) Location Of Closest (long,lat) Values In A 2d Array

I have multiple 2D arrays, three of which are LONG, LAT and HEIGHT. I would like to determine the closest index in these 2D arrays for a given (long,lat). So, within my 2D HEIGHT a

Solution 1:

A few foolish minutes later; I have worked out an answer I believe sufficient:

a = abs( LAT-chosen_lat ) + abs( LONG-chosen_lon )

i,j = np_unravel_index(a.argmin(), a.shape)

Post a Comment for "Find (i,j) Location Of Closest (long,lat) Values In A 2d Array"