-
Notifications
You must be signed in to change notification settings - Fork 303
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
Writing and reading NetCDF file for FCI does not retain fill value #3058
Comments
If I use |
The problem (when calibration is not "counts") is that satpy applies the fill value but also retains it in the metadata. That leads to a fill value (65535) that does not match the actually used value for missing data (nan, then when stored with int32, -2147483648). Either the FCI reader should delete the fill value attribute if it has been applied, or the CF writer should set the correct fill value when applying the dtype. One way is to simply delete the fill value attribute, like in the approach under "Additional context". |
It is common practice (dare I say recommended or maybe even required) for readers to remove |
The reader pops satpy/satpy/readers/fci_l1c_nc.py Lines 359 to 367 in c776b26
|
Describe the bug
Writing a NetCDF file from FCI data, then reading the resulting NetCDF file, does not retain fill value information. Explicitly including
_FillValue
with the encoding fails withValueError
.To Reproduce
Write a NetCDF file:
and read it again:
Expected behavior
I expect that I can read the data that I have written without jumping through hoops, while retaining fill value information.
Actual results
Attempt 1: rely on fill value already in the data
No error messages, but the fill value written to the NetCDF does not match the actually masked data. When reading the data again, the fill value is not understood:
Attempt 2: use
_FillValue
in the encodingAttempt 3:
fill_value=0
is not recognised by this writer:Screenshots
If applicable, add screenshots to help explain your problem.
Environment Info:
Additional context
As a workaround, attempt 2 works if I add
del sc["ir_105"].attrs["_FillValue"]
before saving the data, but this should not be the responsibility of the user and is cumbersome and buggy-prone in an operational environment, such as through trollflow2.The text was updated successfully, but these errors were encountered: