Skip to content
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

Fix bogus no_op implementation #2939

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading