class_docstr: Test case for collect_cf_dataset.
class_docstr_tok: ["Test","case","for","collect_cf_dataset","."]
docstr: Test collecting CF datasets with latitude named lat.
docstr_tok: ["Test","collecting","CF","datasets","with","latitude","named","lat","."]
code: def test_collect_cf_dataset_with_latitude_named_lat(self):
      """Test collecting CF datasets with latitude named lat."""
      from satpy.cf.datasets import _collect_cf_dataset
  
      data = [[75, 2], [3, 4]]
      y = [1, 2]
      x = [1, 2]
      geos = AreaDefinition(
          area_id="geos",
          description="geos",
          proj_id="geos",
          projection={
              "proj": "geos",
              "h": 35785831.0,
              "a": 6378169.0,
              "b": 6356583.8,
          },
          width=2,
          height=2,
          area_extent=[-1, -1, 1, 1],
      )
      datasets = {
          "var1": xr.DataArray(
              data=data, dims=("y", "x"), coords={"y": y, "x": x}
          ),
          "var2": xr.DataArray(
              data=data, dims=("y", "x"), coords={"y": y, "x": x}
          ),
          "lat": xr.DataArray(
              data=data, dims=("y", "x"), coords={"y": y, "x": x}
          ),
          "lon": xr.DataArray(
              data=data, dims=("y", "x"), coords={"y": y, "x": x}
          ),
      }
      datasets["lat"].attrs["standard_name"] = "latitude"
      datasets["var1"].attrs["standard_name"] = "dummy"
      datasets["var2"].attrs["standard_name"] = "dummy"
      datasets["var2"].attrs["area"] = geos
      datasets["var1"].attrs["area"] = geos
      datasets["lat"].attrs["name"] = "lat"
      datasets["var1"].attrs["name"] = "var1"
      datasets["var2"].attrs["name"] = "var2"
      datasets["lon"].attrs["name"] = "lon"
  
      datasets_list = [datasets[key] for key in datasets.keys()]
      datasets_list_no_latlon = [
          datasets[key] for key in ["var1", "var2"]
      ]
  
      # Collect datasets
      ds = _collect_cf_dataset(datasets_list, include_lonlats=True)
      ds2 = _collect_cf_dataset(
          datasets_list_no_latlon, include_lonlats=True
      )
  
      # Test results
      assert len(ds.keys()) == 5
      assert set(ds.keys()) == {"var1", "var2", "lon", "lat", "geos"}
      with pytest.raises(KeyError):
          ds["var1"].attrs["latitude"]
      with pytest.raises(KeyError):
          ds["var1"].attrs["longitude"]
      assert ds2["var1"]["latitude"].attrs["name"] == "latitude"
      assert ds2["var1"]["longitude"].attrs["name"] == "longitude"
  
file_path: satpy/satpy/tests/cf_tests/test_datasets.py
imports: import datetime
  import numpy
  import pytest
  import xarray
  from pyresample import AreaDefinition, create_area_def
label_desc: Use image node_id 2 for calling the TestCollectCfDataset obj's underlying member method code with example usage: obj.test_collect_cf_dataset_with_latitude_named_lat() without return types