Improve read() to handle NaN as NODATA; add tests