Returns a string that can be used for file names, etc. (read the values of the global variables).
Note
We are only saving sec
as an integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(mission_type), | intent(in) | :: | me |
function get_case_name(me) result(case_name) implicit none class(mission_type),intent(in) :: me character(len=:),allocatable :: case_name case_name = int_to_string(me%year,4)//int_to_string(me%month,2)//& int_to_string(me%day,2)//int_to_string(me%hour,2)//& int_to_string(me%minute,2)//int_to_string(int(me%sec),2)//& '_'//me%L1_or_L2//'_'//me%N_or_S//'_NREVS='//int_to_string(me%n_revs) contains !************************************************* function int_to_string(i,ipad) result(str) !! integer to string with zero padding implicit none integer,intent(in) :: i character(len=:),allocatable :: str integer,intent(in),optional :: ipad !! number of digits to pad with zeros character(len=100) :: istr integer :: istat write(istr,'(I100)',iostat=istat) i if (istat==0) then str = trim(adjustl(istr)) if (present(ipad)) then if (len(str)<ipad) then str = repeat('0',ipad-len(str))//str end if end if else str ='****' end if end function int_to_string !************************************************* end function get_case_name