Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data is masked if fill value is set even when the data is not equal to fill value #784

Closed
cpaulik opened this issue Mar 20, 2018 · 3 comments

Comments

@cpaulik
Copy link
Contributor

cpaulik commented Mar 20, 2018

I see this behavior starting with version 1.2.9

The following script:

import netCDF4
import numpy as np

print netCDF4.__version__

with netCDF4.Dataset('test.nc', 'w') as nc4:
    dim = 'test'
    nc4.createDimension(dim, size=10)

    var = nc4.createVariable('test-var', np.int,
                             dim, fill_value=5)
    var[:] = np.arange(10)
    print var[:]
    var.set_auto_maskandscale(False)
    print var[:]

Give the following output:

1.2.9
[0 1 2 3 4 -- -- -- -- --]
[0 1 2 3 4 5 6 7 8 9]

So it seems that everything that is >= the FillValue is masked.

@MeraX
Copy link

MeraX commented Mar 20, 2018

Hi cpaulik,

I stumbled upon a similar problem and found another very related issue, which explains why netCDF4 behaves this way:
#748 (comment)

@cpaulik
Copy link
Contributor Author

cpaulik commented Mar 20, 2018

Ok, I understand. I was checking the netcdf attibute conventions but only checked the entry for FillValue for any clues on why it is implemented that way.

@cpaulik cpaulik closed this as completed Mar 20, 2018
@jswhit
Copy link
Collaborator

jswhit commented Mar 20, 2018

This was changed (see issue #777) so starting with version 1.3.2 it will revert to the old behavior (_FillValue will not act as valid_min/valid_max).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants