docs: def main():
      """Main"""
      import sys
      import h5py
  
      handler = logging.StreamHandler(sys.stderr)
  
      formatter = logging.Formatter(fmt=_DEFAULT_LOG_FORMAT,
                                    datefmt=_DEFAULT_TIME_FORMAT)
      handler.setFormatter(formatter)
      handler.setLevel(logging.DEBUG)
      LOG.setLevel(logging.DEBUG)
      LOG.addHandler(handler)
  
      platform_name = "NOAA-20"
      # platform_name = "Suomi-NPP"
      viirs = ViirsRSR('M1', platform_name)
      filename = os.path.join(viirs.output_dir,
                              "rsr_viirs_{0}.h5".format(platform_name))
  
      with h5py.File(filename, "w") as h5f:
          h5f.attrs['description'] = 'Relative Spectral Responses for VIIRS'
          h5f.attrs['platform_name'] = platform_name
          h5f.attrs['sensor'] = 'viirs'
          h5f.attrs['band_names'] = VIIRS_BAND_NAMES
  
          for chname in VIIRS_BAND_NAMES:
  
              viirs = ViirsRSR(chname, platform_name)
              grp = h5f.create_group(chname)
              grp.attrs['number_of_detectors'] = len(viirs.rsr.keys())
              # Loop over each detector to check if the sampling wavelengths are
              # identical:
              det_names = viirs.rsr.keys()
              wvl = viirs.rsr[det_names[0]]['wavelength']
              wvl, idx = np.unique(wvl, return_index=True)
              wvl_is_constant = True
              for det in det_names[1:]:
                  det_wvl = np.unique(viirs.rsr[det]['wavelength'])
                  if not np.alltrue(wvl == det_wvl):
                      LOG.warning(
                          "Wavelngth arrays are not the same among detectors!")
                      wvl_is_constant = False
  
              if wvl_is_constant:
                  arr = wvl
                  dset = grp.create_dataset('wavelength', arr.shape, dtype='f')
                  dset.attrs['unit'] = 'm'
                  dset.attrs['scale'] = 1e-06
                  dset[...] = arr
  
              # Loop over each detector:
              for det in viirs.rsr:
                  det_grp = grp.create_group(det)
                  wvl = viirs.rsr[det]['wavelength'][
                      ~np.isnan(viirs.rsr[det]['wavelength'])]
                  rsp = viirs.rsr[det]['response'][
                      ~np.isnan(viirs.rsr[det]['wavelength'])]
                  wvl, idx = np.unique(wvl, return_index=True)
                  rsp = np.take(rsp, idx)
                  LOG.debug("wvl.shape: %s", str(wvl.shape))
                  det_grp.attrs[
                      'central_wavelength'] = get_central_wave(wvl, rsp)
                  if not wvl_is_constant:
                      arr = wvl
                      dset = det_grp.create_dataset(
                          'wavelength', arr.shape, dtype='f')
                      dset.attrs['unit'] = 'm'
                      dset.attrs['scale'] = 1e-06
                      dset[...] = arr
  
                  dset = det_grp.create_dataset('response', rsp.shape, dtype='f')
                  dset[...] = rsp