Skip to content

Commit

Permalink
Merge pull request #2939 from mraspaud/no-op-take-2
Browse files Browse the repository at this point in the history
Fix bogus no_op implementation
  • Loading branch information
mraspaud authored Oct 17, 2024
2 parents 936e469 + d62b5d2 commit d61e6e8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 22 deletions.
5 changes: 3 additions & 2 deletions doc/source/composites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,9 @@ the file) as::
default apply the :func:`~trollimage.xrimage.XRImage.stretch_linear` enhancement with
cutoffs of 0.5% and 99.5%. If you want no enhancement at all (maybe you
are enhancing a composite based on :class:`DayNightCompositor` where
the components have their own enhancements defined), you need to define
an enhancement that does nothing::
the components have their own enhancements defined), you can use the `image_ready` standard name.
If this is not a suitable standard name, you can also define
an enhancement that does nothing:

enhancements:
day_x:
Expand Down
5 changes: 0 additions & 5 deletions satpy/enhancements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,3 @@ def _jma_true_color_reproduction(img_data, platform=None):

output = da.dot(img_data.T, ccm.T)
return output.T


def no_op(img):
"""Do not do anything to the image."""
return img.data
4 changes: 1 addition & 3 deletions satpy/etc/enhancements/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,4 @@ enhancements:

image_ready:
standard_name: image_ready
operations:
- name: no_op
method: !!python/name:satpy.enhancements.no_op
operations: []
12 changes: 0 additions & 12 deletions satpy/tests/enhancement_tests/test_enhancements.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,15 +711,3 @@ def test_jma_true_color_reproduction(self):
img = XRImage(self.rgb)
with pytest.raises(KeyError, match="No conversion matrix found for platform Fakesat"):
jma_true_color_reproduction(img)


def test_no_op_enhancement():
"""Test the no-op enhancement."""
from satpy.enhancements import no_op

data = da.arange(-100, 1000, 110).reshape(2, 5)
rgb_data = np.stack([data, data, data])
rgb = xr.DataArray(rgb_data, dims=("bands", "y", "x"),
coords={"bands": ["R", "G", "B"]},
attrs={"platform_name": "Himawari-8"})
assert no_op(rgb) is rgb.data

0 comments on commit d61e6e8

Please sign in to comment.