Skip to content

Commit

Permalink
Fix DifferenceCompositor not using metadata from YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
djhoese committed Mar 11, 2022
1 parent a61e08e commit f00d025
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion satpy/composites/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def __call__(self, projectables, nonprojectables=None, **attrs):
projectables = self.match_data_arrays(projectables)
info = combine_metadata(*projectables)
info['name'] = self.attrs['name']
info.update(attrs)
info.update(self.attrs) # attrs from YAML/__init__
info.update(attrs) # overwriting of DataID properties

proj = projectables[0] - projectables[1]
proj.attrs = info
Expand Down
4 changes: 2 additions & 2 deletions satpy/tests/test_composites.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ def setUp(self):
def test_basic_diff(self):
"""Test that a basic difference composite works."""
from satpy.composites import DifferenceCompositor
comp = DifferenceCompositor(name='diff')
res = comp((self.ds1, self.ds2), standard_name='temperature_difference')
comp = DifferenceCompositor(name='diff', standard_name='temperature_difference')
res = comp((self.ds1, self.ds2))
np.testing.assert_allclose(res.values, -2)
assert res.attrs.get('standard_name') == 'temperature_difference'

Expand Down

0 comments on commit f00d025

Please sign in to comment.