Speed performance of picking unique value from binary matrix file
Try using seek() instead of a loop that reads 1 value at a time.

import io
import struct

#convert x,y indexes of 2D array into index i of 1D array
#x: index for cols in the 2D
#y: index for rows in the 2D
def to1D(y,x,width):
    i = x + width*y
    return i


def readBinary_as(filename,x,y,file_type,width=3601):
    with open(filename,'rb') as file_data:

        #initialize, how many bytes to be read
        nbByte = 0
        #data type of the file, uint, int, float, etc...
        coding = ''
        if file_type == "signed int":
            nbByte = 2
            coding = '&gt;h'  #2B Signed Int - BE

        if file_type == "unsigned int":
            nbByte = 2
            coding = '&gt;H' #2B Unsigned Int - BE

        if file_type == "unsigned byte":
            nbByte = 1
            coding = '&gt;B' #1B Unsigned Byte - BE

        if file_type == "float":
            nbByte = 4
            coding = '&gt;f' #4B float32 - BE

        #index of my value in 1D array
        i = to1D(y,x,width)
        offset = i * nbByte

        # seek to byte offset of desired data
        file_data.seek(offset)

        #read and save the picked value
        my_value_pos = file_data.read(nbByte)
        val = struct.unpack(coding,my_value_pos)[0]
    return val