!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! @ l-old-urange
!
! &1: aaa
! &2: ucenter
! &3: usize
! &4: uaxis
! &5: vaxis
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Find U and V axis number
define integer jaxis[2] kaxis
let jaxis &4 &5
!
let true%ucenter &2
let true%usize &3
!
! Loop over X and Y axis
for iaxis 1 to 2
   ! Alias iaxis number to a simple variable for readability
   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 prange "No X axis in data cube"
      else
         message w prange "No Y axis in data cube"
      endif
      let true%urange%p[iaxis] 1 &1%dim[iaxis]
      let true%urange%m[iaxis] &1%convert[2,iaxis]+(true%urange%p[iaxis]-&1%convert[1,iaxis])*&1%convert[3,iaxis]
   else
      ! iaxis exist => Use its information
      if (true%usize[iaxis].ne.0) then
         ! size[iaxis] != 0 => Use the user-defined range
         if (&1%convert[3,kaxis].gt.0) then
            ! Axis increment > 0 => Plotted direction identical to native direction
            let true%urange%m[iaxis] 'true%ucenter[iaxis]-true%usize[iaxis]/2' 'true%ucenter[iaxis]+true%usize[iaxis]/2'
         else if (&1%convert[3,kaxis].lt.0) then
            ! Axis increment < 0 => Plotted direction inverse to native direction
            let true%urange%m[iaxis] 'true%ucenter[iaxis]+true%usize[iaxis]/2' 'true%ucenter[iaxis]-true%usize[iaxis]/2'
         else
            ! Axis increment = 0 => Problem
            say " "
            message e prange "&1%convert[3,"'kaxis'"] is zero valued"
            say " "
            return base
         endif
         let true%urange%p[iaxis] &1%convert[1,kaxis]+(true%urange%m[iaxis]-&1%convert[2,kaxis])/&1%convert[3,kaxis]
      else
         ! size[iaxis] = 0 => Default to full axis in native direction
         let true%urange%p[iaxis] 1 &1%dim[kaxis]
         ! Define true%urange%m accordingly
         let true%urange%m[iaxis] &1%convert[2,kaxis]+(true%urange%p[iaxis]-&1%convert[1,kaxis])*&1%convert[3,kaxis]
      endif
   endif
next iaxis
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
