Fix read() when nodatavalue is NaN and masked is None

Fixed a couple of typos in the logic regarding tests of NaN in the read data.

Added a test to catch this.