Added masking of NaNs when reading in data, if necessary.