class_docstr: Test utilities used with colormaps.
class_docstr_tok: ["Test","utilities","used","with","colormaps","."]
docstr: Test loading a colormap relative to a config path.
code: def test_cmap_from_config_path(self, tmp_path):
      """Test loading a colormap relative to a config path."""
      import satpy
      from satpy.enhancements import create_colormap
  
      cmap_dir = tmp_path / "colormaps"
      cmap_dir.mkdir()
      cmap_filename = cmap_dir / "my_colormap.npy"
      cmap_data = _generate_cmap_test_data(None, "RGBA")
      np.save(cmap_filename, cmap_data)
      with satpy.config.set(config_path=[tmp_path]):
          rel_cmap_filename = os.path.join(
              "colormaps", "my_colormap.npy"
          )
          cmap = create_colormap(
              {"filename": rel_cmap_filename, "colormap_mode": "RGBA"}
          )
          assert cmap.colors.shape[0] == 4
          assert cmap.colors.shape[1] == 4  # RGBA
          np.testing.assert_equal(
              cmap.colors[0], [128 / 255.0, 1.0, 0, 0]
          )
          assert cmap.values.shape[0] == 4
          assert cmap.values[0] == 0
          assert cmap.values[-1] == 1.0
  
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 5 for calling the TestColormapLoading obj's underlying member method code with example usage: obj.test_cmap_from_config_path(tmp_path) without return types