class_docstr: Test various utility functions for working with coordinates.
class_docstr_tok: ["Test","various","utility","functions","for","working","with","coordinates","."]
docstr: Test coordinates being added with an SwathDefinition.
code: def test_swath_def_coordinates(self):
      """Test coordinates being added with an SwathDefinition."""
      from pyresample.geometry import SwathDefinition
  
      from satpy.resample import add_crs_xy_coords
  
      lons_data = da.random.random((200, 100), chunks=50)
      lats_data = da.random.random((200, 100), chunks=50)
      lons = xr.DataArray(
          lons_data, attrs={"units": "degrees_east"}, dims=("y", "x")
      )
      lats = xr.DataArray(
          lats_data, attrs={"units": "degrees_north"}, dims=("y", "x")
      )
      area_def = SwathDefinition(lons, lats)
      data_arr = xr.DataArray(
          da.zeros((200, 100), chunks=50),
          attrs={"area": area_def},
          dims=("y", "x"),
      )
      new_data_arr = add_crs_xy_coords(data_arr, area_def)
      # See https://github.com/pydata/xarray/issues/3068
      # self.assertIn('longitude', new_data_arr.coords)
      # self.assertIn('units', new_data_arr.coords['longitude'].attrs)
      # self.assertEqual(
      #     new_data_arr.coords['longitude'].attrs['units'], 'degrees_east')
      # self.assertIsInstance(new_data_arr.coords['longitude'].data, da.Array)
      # self.assertIn('latitude', new_data_arr.coords)
      # self.assertIn('units', new_data_arr.coords['latitude'].attrs)
      # self.assertEqual(
      #     new_data_arr.coords['latitude'].attrs['units'], 'degrees_north')
      # self.assertIsInstance(new_data_arr.coords['latitude'].data, da.Array)
  
      assert "crs" in new_data_arr.coords
      crs = new_data_arr.coords["crs"].item()
      assert isinstance(crs, CRS)
      assert crs.is_geographic
      assert isinstance(new_data_arr.coords["crs"].item(), CRS)
  
imports: import os
  import shutil
  import tempfile
  import unittest
  from unittest import mock
  import dask.array
  import numpy
  import pytest
  import xarray
  from pyproj import CRS
  from satpy.resample import NativeResampler
label_desc: Use image node_id 2 for calling the TestCoordinateHelpers obj's underlying member method code with example usage: obj.test_swath_def_coordinates() without return types