Closed GoogleCodeExporter closed 8 years ago
If you want, you can turn this off using the set_auto_maskandscale method of
the netcdf variable:
http://netcdf4-python.googlecode.com/svn/trunk/docs/netCDF4.Variable-class.html#
set_auto_maskandscale
It is unfortunate that masked arrays are not complete drop-in replacements for
regular numpy arrays. However, I think the benefits of returning a masked
array by default outweight the potential pitfalls. In fact, the default
setting for set_auto_maskandscale was initially false (it hard to be turned on
by the user), but so many users complained that I changed the default to True.
Original comment by whitaker.jeffrey@gmail.com
on 22 Apr 2013 at 10:49
The numpy developers are working on a replacement for masked arrays, which will
hopefully address the issues you see:
http://www.compsci.wm.edu/SciClone/documentation/software/math/NumPy/html1.7/ref
erence/arrays.maskna.html
Perhaps once this is fully implemented netcdf4-python can just always return
numpy.NA objects.
Original comment by whitaker.jeffrey@gmail.com
on 22 Apr 2013 at 10:56
Thanks I missed the set_auto_maskandscale option somehow. I can see why the
users wanted this value to be True by default; masked arrays are a good way to
cope with the fill values.
IMHO, the best implementation would be that, when the set_auto_maskandscale
flag is True, the resulting array is always a masked array if the _FillValue
attribute is present, regardless if the variable contains actual fill values or
not.
However, if you would just implement this it would probably break a lot of
peoples existing code. What do you think?
Original comment by titus...@gmail.com
on 25 Apr 2013 at 1:08
Original comment by whitaker.jeffrey@gmail.com
on 26 Feb 2014 at 2:04
Original issue reported on code.google.com by
titus...@gmail.com
on 19 Apr 2013 at 5:03Attachments: