code: def horizrad(infn: Path, outfn: Path, c1: dict) -> xarray.Dataset:
      
      if infn is not None:
          infn = Path(infn).expanduser()
  
          if infn.suffix == '.h5':
              TR = xarray.open_dataset(infn)
              return TR
  
      c1.update({'model': 0,  # 0: user meterological data
                 'itype': 1,  # 1: horizontal path
                 'iemsct': 1,  # 1: radiance model
                 'im': 1,    # 1: for horizontal path (see Lowtran manual p.42)
                 'ird1': 1,  # 1: use card 2C2)
                 })
  # %% read csv file
      if not infn:  # demo mode
          c1['p'] = [949., 959.]
          c1['t'] = [283.8, 285.]
          c1['wmol'] = [[93.96, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
                        [93.96, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]
          c1['time'] = [parse('2017-04-05T12'),
                        parse('2017-04-05T18')]
      else:  # read csv, normal case
          PTdata = read_csv(infn)
          c1['p'] = PTdata['p']
          c1['t'] = PTdata['Ta']
          c1['wmol'] = np.zeros((PTdata.shape[0], 12))
          c1['wmol'][:, 0] = PTdata['RH']
          c1['time'] = [parse(t) for t in PTdata['time']]
  # %% TR is 3-D array with axes: time, wavelength, and [transmission,radiance]
      TR = loopuserdef(c1)
  
      return TR
docs: read CSV, simulate, write, plot