set_time_unit Subroutine

public subroutine set_time_unit(k)

Switch time unit to UNAME(k), keeping view.

Rescales x view limits on a time axis, rebuilds model axes.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: k

Unit index into units.f90 tables.


Source Code

   subroutine set_time_unit(k)
      !! Switch time unit to `UNAME(k)`, keeping view.
      !!
      !! Rescales x view limits on a time axis, rebuilds model axes.
      ! Arguments
      integer(int32), intent(in) :: k
         !! Unit index into units.f90 tables.
      if (UNAME(k) == st%tunit) return
      if (st%xaxis == 'time') then
         st%xmin = st%xmin*UFAC(unit_id(st%tunit))/UFAC(k)
         st%xmax = st%xmax*UFAC(unit_id(st%tunit))/UFAC(k)
      end if
      st%tunit = UNAME(k)
      call build_axes()
   end subroutine set_time_unit