!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! @ l-old-channel
!
! &1: aaa header
! &2: channel value
! &3: channel unit  [C|V|F]
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Sanity Check
if (&1%f_axis.eq.0) then
   message w channel "No frequency axis in data cube"
   let true%chan%p 1
   let true%chan%v 0
   let true%chan%f 0
   return
endif
!
! Find velocity axis
define integer vaxis
let vaxis &1%f_axis  ! ZZZ this assumes a velocity axis, not a frequency axis
!
! Define true%chan values
! No clever default here because there is no way I can know whether
! a value of zero is valid or not here...
if (&1%convert[3,vaxis].eq.0) then
   ! Velocity increment = 0 => Problem
   say " "
   message e channel "velocity increment (&1%convert[3,"'vaxis'"]) is zero valued"
   say " "
   return base
endif
if pro%arg[3].eq."V" then
   let true%chan%v &2
   let true%chan%f &1%restfre+(true%chan%v-&1%convert[2,vaxis])*(&1%freqres/&1%convert[3,vaxis])
   let true%chan%p &1%convert[1,vaxis]+(true%chan%v-&1%convert[2,vaxis])/&1%convert[3,vaxis]
else if pro%arg[3].eq."C" then
   let true%chan%p &2
   let true%chan%v (true%chan%p-&1%convert[1,vaxis])*&1%convert[3,vaxis]+&1%convert[2,vaxis]
   let true%chan%f &1%restfre+(true%chan%v-&1%convert[2,vaxis])*(&1%freqres/&1%convert[3,vaxis])
else
   say " "
   message e channel "Unit "'pro%arg[3]'" is not implemented"
   say " "
   return base
endif
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
