pyTMD icon indicating copy to clipboard operation
pyTMD copied to clipboard

read_FES_model.py: explicit definition of hc.mask fails on NaN fill_value

Open ludwigus opened this issue 3 years ago • 1 comments

Hi, in read_FES_model.py at the very end of read_netcdf_file you explicitly set the mask using hc.mask = (amp.data == amp.fill_value) | (ph.data == ph.fill_value) However, this doesn't work if fill_value is np.nan as comparing to nan is always false. Moreover, this is just creating the problem at all. When you read amp and ph using the NetCDF4 module, they are already masked arrays. So, calculating hc from these masked arrays already sets the mask correctly. On the next line, however, this correct mask is overwritten (without any need), causing this bug. I suggest to simply remove #-- set masks and the following line from read_netcdf_file in read_FES_model.

ludwigus avatar Apr 20 '22 12:04 ludwigus

You're right. That's a problem. I'll get this fixed today

tsutterley avatar Apr 20 '22 13:04 tsutterley