class_docstr: Test case for CF writer.
docstr: Test saving array with coordinates.
docstr_tok: ["Test","saving","array","with","coordinates","."]
code: def test_save_array_coords(self):
      """Test saving array with coordinates."""
      scn = Scene()
      start_time = datetime(2018, 5, 30, 10, 0)
      end_time = datetime(2018, 5, 30, 10, 15)
      coords = {
          "x": np.arange(3),
          "y": np.arange(1),
      }
      if CRS is not None:
          proj_str = (
              "+proj=geos +lon_0=-95.0 +h=35786023.0 "
              "+a=6378137.0 +b=6356752.31414 +sweep=x "
              "+units=m +no_defs"
          )
          coords["crs"] = CRS.from_string(proj_str)
      scn["test-array"] = xr.DataArray(
          [[1, 2, 3]],
          dims=("y", "x"),
          coords=coords,
          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]]
              )
              np.testing.assert_array_equal(f["x"][:], [0, 1, 2])
              np.testing.assert_array_equal(f["y"][:], [0])
              assert "crs" not in f
              assert "_FillValue" not in f["x"].attrs
              assert "_FillValue" not in f["y"].attrs
              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 3 for calling the TestCFWriter obj's underlying member method code with example usage: obj.test_save_array_coords() without return types