Skip to content

Commit 55eaccd

Browse files
mjs2369hkershaw-brown
authored andcommitted
Removing loops in time_manager_mod that are not needed
1 parent e218864 commit 55eaccd

File tree

1 file changed

+37
-55
lines changed

1 file changed

+37
-55
lines changed

assimilation_code/modules/utilities/time_manager_mod.f90

+37-55
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ subroutine set_calendar_type_string(calstring)
694694
character(len=len(calstring)) :: str1
695695
character(len=max_calendar_string_length) :: cstring
696696
logical :: found_calendar = .false.
697-
integer :: i
698697

699698
if ( .not. module_initialized ) call time_manager_init
700699

@@ -714,47 +713,34 @@ subroutine set_calendar_type_string(calstring)
714713
! We must check for the gregorian_mars calendar before
715714
! the gregorian calendar for similar reasons.
716715

717-
WhichCalendar : do i = 0, max_type
718-
719-
if ( cstring == 'NO_CALENDAR' ) then
720-
calendar_type = NO_CALENDAR
721-
found_calendar = .true.
722-
exit WhichCalendar
723-
elseif ( cstring == 'NO CALENDAR' ) then ! allow this as a synonym
724-
calendar_type = NO_CALENDAR
725-
found_calendar = .true.
726-
exit WhichCalendar
727-
elseif ( cstring == 'NONE' ) then ! also allow this
728-
calendar_type = NO_CALENDAR
729-
found_calendar = .true.
730-
exit WhichCalendar
731-
elseif ( cstring == 'THIRTY_DAY_MONTHS' ) then
732-
calendar_type = THIRTY_DAY_MONTHS
733-
found_calendar = .true.
734-
exit WhichCalendar
735-
elseif ( cstring == 'JULIAN' ) then
736-
calendar_type = JULIAN
737-
found_calendar = .true.
738-
exit WhichCalendar
739-
elseif ( cstring == 'NOLEAP' ) then
740-
calendar_type = NOLEAP
741-
found_calendar = .true.
742-
exit WhichCalendar
743-
elseif ( cstring == 'GREGORIAN_MARS' ) then
744-
calendar_type = GREGORIAN_MARS
745-
found_calendar = .true.
746-
exit WhichCalendar
747-
elseif ( cstring == 'SOLAR_MARS' ) then
748-
calendar_type = SOLAR_MARS
749-
found_calendar = .true.
750-
exit WhichCalendar
751-
elseif ( cstring == 'GREGORIAN' ) then
752-
calendar_type = GREGORIAN
753-
found_calendar = .true.
754-
exit WhichCalendar
755-
endif
756-
757-
enddo WhichCalendar
716+
if ( cstring == 'NO_CALENDAR' ) then
717+
calendar_type = NO_CALENDAR
718+
found_calendar = .true.
719+
elseif ( cstring == 'NO CALENDAR' ) then ! allow this as a synonym
720+
calendar_type = NO_CALENDAR
721+
found_calendar = .true.
722+
elseif ( cstring == 'NONE' ) then ! also allow this
723+
calendar_type = NO_CALENDAR
724+
found_calendar = .true.
725+
elseif ( cstring == 'THIRTY_DAY_MONTHS' ) then
726+
calendar_type = THIRTY_DAY_MONTHS
727+
found_calendar = .true.
728+
elseif ( cstring == 'JULIAN' ) then
729+
calendar_type = JULIAN
730+
found_calendar = .true.
731+
elseif ( cstring == 'NOLEAP' ) then
732+
calendar_type = NOLEAP
733+
found_calendar = .true.
734+
elseif ( cstring == 'GREGORIAN_MARS' ) then
735+
calendar_type = GREGORIAN_MARS
736+
found_calendar = .true.
737+
elseif ( cstring == 'SOLAR_MARS' ) then
738+
calendar_type = SOLAR_MARS
739+
found_calendar = .true.
740+
elseif ( cstring == 'GREGORIAN' ) then
741+
calendar_type = GREGORIAN
742+
found_calendar = .true.
743+
endif
758744

759745
if( .not. found_calendar ) then
760746
write(errstring,*)'Unknown calendar ',calstring
@@ -785,23 +771,19 @@ subroutine get_calendar_string(mystring)
785771
!
786772
! Returns default calendar type for mapping from time to date.
787773

788-
character(len=*), intent(OUT) :: mystring
789-
790-
integer :: i
774+
character(len=*), intent(out) :: mystring
791775

792776
if ( .not. module_initialized ) call time_manager_init
793777

794-
mystring = ' '
778+
mystring = ''
795779

796-
do i = 0,max_type
797-
if (calendar_type == JULIAN) mystring = 'JULIAN'
798-
if (calendar_type == NOLEAP) mystring = 'NOLEAP'
799-
if (calendar_type == GREGORIAN) mystring = 'GREGORIAN'
800-
if (calendar_type == NO_CALENDAR) mystring = 'NO_CALENDAR'
801-
if (calendar_type == GREGORIAN_MARS) mystring = 'GREGORIAN_MARS'
802-
if (calendar_type == SOLAR_MARS) mystring = 'SOLAR_MARS'
803-
if (calendar_type == THIRTY_DAY_MONTHS) mystring = 'THIRTY_DAY_MONTHS'
804-
enddo
780+
if (calendar_type == JULIAN) mystring = 'JULIAN'
781+
if (calendar_type == NOLEAP) mystring = 'NOLEAP'
782+
if (calendar_type == GREGORIAN) mystring = 'GREGORIAN'
783+
if (calendar_type == NO_CALENDAR) mystring = 'NO_CALENDAR'
784+
if (calendar_type == GREGORIAN_MARS) mystring = 'GREGORIAN_MARS'
785+
if (calendar_type == SOLAR_MARS) mystring = 'SOLAR_MARS'
786+
if (calendar_type == THIRTY_DAY_MONTHS) mystring = 'THIRTY_DAY_MONTHS'
805787

806788
if (len_trim(mystring) < 3) then
807789
write(errstring,*)'unknown calendar type ', calendar_type

0 commit comments

Comments
 (0)