class_docstr: Encodes numpy ndarray with compression into a spark dataframe field
code: def encode(self, unischema_field, value):
      expected_dtype = unischema_field.numpy_dtype
      if isinstance(value, np.ndarray):
          if expected_dtype != value.dtype.type:
              raise ValueError(
                  "Unexpected type of {} feature. "
                  "Expected {}. Got {}".format(
                      unischema_field.name, expected_dtype, value.dtype
                  )
              )
  
          expected_shape = unischema_field.shape
          if not _is_compliant_shape(value.shape, expected_shape):
              raise ValueError(
                  "Unexpected dimensions of {} feature. "
                  "Expected {}. Got {}".format(
                      unischema_field.name, expected_shape, value.shape
                  )
              )
      else:
          raise ValueError(
              "Unexpected type of {} feature. "
              "Expected ndarray of {}. Got {}".format(
                  unischema_field.name, expected_dtype, type(value)
              )
          )
  
      memfile = BytesIO()
      np.savez_compressed(memfile, arr=value)
      return bytearray(memfile.getvalue())
  
imports: from abc import abstractmethod
  from io import BytesIO
  import numpy
label_desc: Use image node_id 1 for calling the CompressedNdarrayCodec obj's underlying member method code with example usage: obj.encode(unischema_field, value) and returns: bytearray