title: Read a float binary file into 2D arrays in python and matlab
body: <p>I have some binary input files (extension ".bin") that describe a 2D field of ocean depth and which are all negative float numbers. I have been able to load them in matlab as follows:</p>
  
  <pre><code>f = fopen(filename,'r','b');
  data = reshape(fread(f,'float32'),[128 64]);
  </code></pre>
  
  <p>This matlab code gives me double values between 0 and -5200. However, when I try to the same in Python, I strangely get values between 0 and 1e-37. The Python code is:</p>
  
  <pre><code>f = open(filename, 'rb')
  data = np.fromfile(f, np.float32)
  data.shape = (64,128)
  </code></pre>
  
  <p>The strange thing is that there is a mask value of 0 for land which shows up in the right places in the (64,128) array in both cases. It seems to just be the magnitude and sign of the <code>numpy.float32</code> values that are off.</p>
  
  <p>What am I doing wrong in the Python code?</p>