!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! @ l-old-sampling
!
! Definition of unsigned sampling (default is Nyquist)
!
! &1: aaa
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Find X and Y axis number
define integer jaxis[2] kaxis
let jaxis '&1%x_axis' '&1%y_axis'
!
! Loop over X and Y axis
for iaxis 1 to 2
   ! Alias iaxis number to a simple variable for readibility
   let kaxis jaxis[iaxis]
   ! Sanity check
   if (kaxis.eq.0) then
      ! iaxis does not exist => Try something clever...
      if (iaxis.eq.1) then
         message w sampling "No X axis in data cube"
      else
         message w sampling "No Y axis in data cube"
      endif
      let true%sampling%p[iaxis] 1
      let true%sampling%s[iaxis] 0
      let true%sampling%r[iaxis] 0
   else
      ! iaxis exist => Use its information
      ! First, define the sampling in radian
      if (sampling[iaxis].ne.0) then
         ! sampling[iaxis] != 0 => Use the user-defined range
         let true%sampling%r[iaxis] abs(sampling[iaxis]*sec)
      else
         ! sampling[iaxis] = 0 => Default to Nyquist
         let true%sampling%r[iaxis] 0.5*sqrt(abs(&1%major*&1%minor))
      endif
      ! Then, convert in pixel
      if (&1%convert[3,kaxis].ne.0) then
         ! Axis increment != 0 => OK
         let true%sampling%p[iaxis] abs(true%sampling%r[iaxis]/&1%convert[3,kaxis])
         let true%sampling%p[iaxis] max(1,min(&1%dim[kaxis],true%sampling%p[iaxis]))
      else
         ! Axis increment = 0 => Problem
         say " "
         message e sampling "&1%convert[3,"'kaxis'"] is zero valued"
         say " "
         return base
      endif
      ! Finally, resic\compute sampling in radian and second for consistency
      let true%sampling%r[iaxis] abs(&1%convert[3,kaxis]*true%sampling%p[iaxis])
      let true%sampling%s[iaxis] true%sampling%r[iaxis]/sec
   endif
next iaxis
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
