class_docstr: Test the ViiNCBaseFileHandler reader.
class_docstr_tok: ["Test","the","ViiNCBaseFileHandler","reader","."]
docstr: Set up the test.
docstr_tok: ["Set","up","the","test","."]
code: def setUp(self, pgi_):
      """Set up the test."""
      # Easiest way to test the reader is to create a test netCDF file on the fly
      # uses a UUID to avoid permission conflicts during execution of tests in parallel
      self.test_file_name = TEST_FILE + str(uuid.uuid1()) + ".nc"
  
      with Dataset(self.test_file_name, "w") as nc:
          # Add global attributes
          nc.sensing_start_time_utc = "20170920173040.888"
          nc.sensing_end_time_utc = "20170920174117.555"
          nc.spacecraft = "test_spacecraft"
          nc.instrument = "test_instrument"
  
          # Create data group
          g1 = nc.createGroup("data")
  
          # Add dimensions to data group
          g1.createDimension("num_pixels", 10)
          g1.createDimension("num_lines", 100)
  
          # Create data/measurement_data group
          g1_1 = g1.createGroup("measurement_data")
  
          # Add dimensions to data/measurement_data group
          g1_1.createDimension("num_tie_points_act", 10)
          g1_1.createDimension("num_tie_points_alt", 100)
  
          # Add variables to data/measurement_data group
          tpw = g1_1.createVariable(
              "tpw", np.float32, dimensions=("num_pixels", "num_lines")
          )
          tpw[:] = 1.0
          tpw.test_attr = "attr"
          lon = g1_1.createVariable(
              "longitude",
              np.float32,
              dimensions=("num_tie_points_act", "num_tie_points_alt"),
          )
          lon[:] = 100.0
          lat = g1_1.createVariable(
              "latitude",
              np.float32,
              dimensions=("num_tie_points_act", "num_tie_points_alt"),
          )
          lat[:] = 10.0
  
          # Create quality group
          g2 = nc.createGroup("quality")
  
          # Add dimensions to quality group
          g2.createDimension("gap_items", 2)
  
          # Add variables to quality group
          var = g2.createVariable(
              "duration_of_product", np.double, dimensions=()
          )
          var[:] = 1.0
          var = g2.createVariable(
              "duration_of_data_present", np.double, dimensions=()
          )
          var[:] = 2.0
          var = g2.createVariable(
              "duration_of_data_missing", np.double, dimensions=()
          )
          var[:] = 3.0
          var = g2.createVariable(
              "duration_of_data_degraded", np.double, dimensions=()
          )
          var[:] = 4.0
          var = g2.createVariable(
              "gap_start_time_utc", np.double, dimensions=("gap_items",)
          )
          var[:] = [5.0, 6.0]
          var = g2.createVariable(
              "gap_end_time_utc", np.double, dimensions=("gap_items",)
          )
          var[:] = [7.0, 8.0]
  
      # Create longitude and latitude "interpolated" arrays
      interp_longitude = xr.DataArray(np.ones((10, 100)))
      interp_latitude = xr.DataArray(np.ones((10, 100)) * 2.0)
      pgi_.return_value = (interp_longitude, interp_latitude)
  
      # Filename info valid for all readers
      filename_info = {
          "creation_time": datetime.datetime(
              year=2017, month=9, day=22, hour=22, minute=40, second=10
          ),
          "sensing_start_time": datetime.datetime(
              year=2017, month=9, day=20, hour=12, minute=30, second=30
          ),
          "sensing_end_time": datetime.datetime(
              year=2017, month=9, day=20, hour=18, minute=30, second=50
          ),
      }
  
      # Create a reader
      self.reader = ViiNCBaseFileHandler(
          filename=self.test_file_name,
          filename_info=filename_info,
          filetype_info={
              "cached_longitude": "data/measurement_data/longitude",
              "cached_latitude": "data/measurement_data/latitude",
          },
      )
  
      # Create a second reader where orthorectification and interpolation are inhibited
      # by means of the filetype_info flags
      self.reader_2 = ViiNCBaseFileHandler(
          filename=self.test_file_name,
          filename_info=filename_info,
          filetype_info={
              "cached_longitude": "data/measurement_data/longitude",
              "cached_latitude": "data/measurement_data/latitude",
              "interpolate": False,
              "orthorect": False,
          },
          orthorect=True,
      )
  
      # Create a third reader without defining cached latitude and longitude
      # by means of the filetype_info flags
      self.reader_3 = ViiNCBaseFileHandler(
          filename=self.test_file_name,
          filename_info=filename_info,
          filetype_info={},
          orthorect=True,
      )
  
file_path: satpy/satpy/tests/reader_tests/test_vii_base_nc.py
imports: import datetime
  import os
  import unittest
  import uuid
  from unittest import mock
  import numpy
  import pytest
  import xarray
  from netCDF4 import Dataset
  from satpy.readers.vii_base_nc import SCAN_ALT_TIE_POINTS, TIE_POINTS_FACTOR, ViiNCBaseFileHandler
label_desc: Use image node_id 1 for calling the TestViiNCBaseFileHandler obj's underlying member method code with example usage: obj.setUp(pgi_) without return types