class_docstr: Test case for CF writer.
docstr: Test saving an array to netcdf/cf.
docstr_tok: ["Test","saving","an","array","to","netcdf\/cf","."]
code: def test_save_array(self):
      """Test saving an array to netcdf/cf."""
      scn = Scene()
      start_time = datetime(2018, 5, 30, 10, 0)
      end_time = datetime(2018, 5, 30, 10, 15)
      scn["test-array"] = xr.DataArray(
          [1, 2, 3],
          attrs=dict(
              start_time=start_time,
              end_time=end_time,
              prerequisites=[make_dsq(name="hej")],
          ),
      )
      with TempFile() as filename:
          scn.save_datasets(filename=filename, writer="cf")
          with xr.open_dataset(filename) as f:
              np.testing.assert_array_equal(
                  f["test-array"][:], [1, 2, 3]
              )
              expected_prereq = "DataQuery(name='hej')"
              assert (
                  f["test-array"].attrs["prerequisites"]
                  == expected_prereq
              )
  
imports: import os
  import tempfile
  import warnings
  from datetime import datetime
  import numpy
  import pytest
  import xarray
  from packaging.version import Version
  from satpy import Scene
  from satpy.tests.utils import make_dsq
  from satpy.writers.cf_writer import _get_backend_versions
label_desc: Use image node_id 2 for calling the TestCFWriter obj's underlying member method code with example usage: obj.test_save_array() without return types