Skip to content

Commit

Permalink
BUG FIX: This commits the check for valid_range before applying.
Browse files Browse the repository at this point in the history
  • Loading branch information
joleenf committed Jun 22, 2021
1 parent 0b9009e commit a7e4b31
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions satpy/readers/virr_l1b.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ def get_dataset(self, dataset_id, ds_info):
valid_range = data.attrs.pop('valid_range', None)
if band_index is not None:
data = data[band_index]
data = data.where((data >= valid_range[0]) &
(data <= valid_range[1]))
if valid_range:
data = data.where((data >= valid_range[0]) &
(data <= valid_range[1]))
if 'Emissive' in file_key:
slope = self._correct_slope(self[self.l1b_prefix + 'Emissive_Radiance_Scales'].
data[:, band_index][:, np.newaxis])
Expand All @@ -123,8 +124,9 @@ def get_dataset(self, dataset_id, ds_info):
slope = self._correct_slope(self[file_key + '/attr/Slope'])
intercept = self[file_key + '/attr/Intercept']

data = data.where((data >= valid_range[0]) &
(data <= valid_range[1]))
if valid_range:
data = data.where((data >= valid_range[0]) &
(data <= valid_range[1]))
data = data * slope + intercept
new_dims = {old: new for old, new in zip(data.dims, ('y', 'x'))}
data = data.rename(new_dims)
Expand Down

0 comments on commit a7e4b31

Please sign in to comment.