code: def _encode_numpy_array(obj):
      """Encode numpy array as a netCDF4 serializable datatype."""
      from satpy.writers.cf_writer import NC4_DTYPES
  
      # Only plain 1-d arrays are supported. Skip record arrays and multi-dimensional arrays.
      is_plain_1d = not obj.dtype.fields and len(obj.shape) <= 1
      if not is_plain_1d:
          raise ValueError(
              "Only a 1D numpy array can be encoded as netCDF attribute."
          )
      if obj.dtype in NC4_DTYPES:
          return obj
      if obj.dtype == np.bool_:
          # Boolean arrays are not supported, convert to array of strings.
          return [s.lower() for s in obj.astype(str)]
      return obj.tolist()
  
imports: from __future__ import annotations
  import datetime
  import json
  import logging
  from collections import OrderedDict
  import numpy
  import xarray
  from satpy.writers.utils import flatten_dict
label_desc: Use image node_id 1 for calling a global function with example usage: _encode_numpy_array(obj) and returns: obj, obj, unknown