class_docstr: Test HDF5 File Handler Utility class.
class_docstr_tok: ["Test","HDF5","File","Handler","Utility","class","."]
docstr: Create a test HDF5 file.
docstr_tok: ["Create","a","test","HDF5","file","."]
code: def setUp(self):
      """Create a test HDF5 file."""
      import h5py
  
      h = h5py.File("test.h5", "w")
      # Create Group
      g1 = h.create_group("test_group")
  
      # Add datasets
      ds1_f = g1.create_dataset(
          "ds1_f",
          shape=(10, 100),
          dtype=np.float32,
          data=np.arange(10.0 * 100).reshape((10, 100)),
      )
      ds1_i = g1.create_dataset(
          "ds1_i",
          shape=(10, 100),
          dtype=np.int32,
          data=np.arange(10 * 100).reshape((10, 100)),
      )
      ds2_f = h.create_dataset(
          "ds2_f",
          shape=(10, 100),
          dtype=np.float32,
          data=np.arange(10.0 * 100).reshape((10, 100)),
      )
      ds2_i = h.create_dataset(
          "ds2_i",
          shape=(10, 100),
          dtype=np.int32,
          data=np.arange(10 * 100).reshape((10, 100)),
      )
  
      # Add attributes
      # shows up as a scalar array of bytes (shape=(), size=1)
      h.attrs["test_attr_str"] = "test_string"
      h.attrs["test_attr_byte"] = b"test_byte"
      h.attrs["test_attr_int"] = 0
      h.attrs["test_attr_float"] = 1.2
      # shows up as a numpy bytes object
      h.attrs["test_attr_str_arr"] = np.array(b"test_string2")
      g1.attrs["test_attr_str"] = "test_string"
      g1.attrs["test_attr_byte"] = b"test_byte"
      g1.attrs["test_attr_int"] = 0
      g1.attrs["test_attr_float"] = 1.2
      for d in [ds1_f, ds1_i, ds2_f, ds2_i]:
          d.attrs["test_attr_str"] = "test_string"
          d.attrs["test_attr_byte"] = b"test_byte"
          d.attrs["test_attr_int"] = 0
          d.attrs["test_attr_float"] = 1.2
          d.attrs["test_ref"] = d.ref
      self.var_attrs = list(d.attrs.keys())
  
      h.close()
  
file_path: satpy/satpy/tests/reader_tests/test_hdf5_utils.py
imports: import os
  import unittest
  import numpy
label_desc: Use image node_id 1 for calling the TestHDF5FileHandler obj's underlying member method code with example usage: obj.setUp() without return types