class_docstr: Test HDF4 File Handler Utility class.
class_docstr_tok: ["Test","HDF4","File","Handler","Utility","class","."]
docstr: Create a test HDF4 file.
docstr_tok: ["Create","a","test","HDF4","file","."]
code: def setUp(self):
      """Create a test HDF4 file."""
      from pyhdf.SD import SD, SDC
  
      h = SD("test.hdf", SDC.WRITE | SDC.CREATE | SDC.TRUNC)
      data = np.arange(10.0 * 100, dtype=np.float32).reshape((10, 100))
      v1 = h.create("ds1_f", SDC.FLOAT32, (10, 100))
      v1[:] = data
      v2 = h.create("ds1_i", SDC.INT16, (10, 100))
      v2[:] = data.astype(np.int16)
  
      # Add attributes
      h.test_attr_str = "test_string"
      h.test_attr_int = 0
      h.test_attr_float = 1.2
      # h.test_attr_str_arr = np.array(b"test_string2")
      for d in [v1, v2]:
          d.test_attr_str = "test_string"
          d.test_attr_int = 0
          d.test_attr_float = 1.2
  
      h.end()
  
file_path: satpy/satpy/tests/reader_tests/test_hdf4_utils.py
imports: import os
  import unittest
  import numpy
  import xarray
label_desc: Use image node_id 1 for calling the TestHDF4FileHandler obj's underlying member method code with example usage: obj.setUp() without return types