class_docstr: Class for testing enhancements in satpy.enhancements.
class_docstr_tok: ["Class","for","testing","enhancements","in","satpy.enhancements","."]
docstr: Test the piecewise_linear_stretch enhancement function.
code: def test_piecewise_linear_stretch(self):
      """Test the piecewise_linear_stretch enhancement function."""
      from satpy.enhancements import piecewise_linear_stretch
  
      expected = np.array(
          [
              [
                  [np.nan, 0.0, 0.0, 0.44378, 0.631734],
                  [0.737562, 0.825041, 0.912521, 1.0, 1.0],
              ]
          ]
      )
      run_and_check_enhancement(
          piecewise_linear_stretch,
          self.ch2 / 100.0,
          expected,
          xp=[0.0, 25.0, 55.0, 100.0, 255.0],
          fp=[0.0, 90.0, 140.0, 175.0, 255.0],
          reference_scale_factor=255,
      )
  
imports: import contextlib
  import os
  from tempfile import NamedTemporaryFile
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from satpy.enhancements import create_colormap, on_dask_array, on_separate_bands, using_map_blocks
label_desc: Use image node_id 9 for calling the TestEnhancementStretch obj's underlying member method code with example usage: obj.test_piecewise_linear_stretch() without return types