! @ stokes-split GenericName
!
if ("&1 ".eq."? ").or.(pro%narg.eq.0) then
  SAY " @ stokes-split Name"
  SAY " "
  SAY "     Split a (UVT or UVFITS) data file that contains 4 polarization states into 4"
  SAY "  Gildas UV tables, one for each of the Stokes parameters I,Q,U,V"
  SAY "     Naming convention applies: the input name is appended by -S where S is Stokes"
  SAY "  parameter of the data, any of I,Q,U,V"
  return
endif
if .not.file("&1.uvt") then
  read uv &1.uvfits
  write uv &1.uvt
endif
read uv &1.uvt
define char*1 stokes[4]
let stokes I Q U V
for ch /in stokes
  stokes 'CH'
  write uv &1-'CH'
  uv_comp     ! Back to initial UV data, without reading it again...
next
