Skip to content

Commit

Permalink
Merge pull request pytroll#1710 from djhoese/bugfix-nucaps-fill-value
Browse files Browse the repository at this point in the history
Fix NUCAPS reader having incorrect _FillValue attribute
  • Loading branch information
djhoese committed Jun 2, 2021
2 parents f4fb747 + e7855b9 commit 1289aa3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions satpy/readers/nucaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ def get_dataset(self, dataset_id, ds_info):
data = data.where((data <= valid_max)) # | (data >= valid_min))
if fill_value is not None:
data = data.where(data != fill_value)
# this _FillValue is no longer valid
metadata.pop('_FillValue', None)
data.attrs.pop('_FillValue', None)

data.attrs.update(metadata)
# Older format
Expand Down
2 changes: 2 additions & 0 deletions satpy/tests/reader_tests/test_nucaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def test_load_pressure_based(self):
for v in datasets.values():
# self.assertNotEqual(v.info['resolution'], 0)
self.assertEqual(v.ndim, 2)
if np.issubdtype(v.dtype, np.floating):
assert '_FillValue' not in v.attrs

def test_load_individual_pressure_levels_true(self):
"""Test loading Temperature with individual pressure datasets."""
Expand Down

0 comments on commit 1289aa3

Please sign in to comment.