Skip to content

Commit 2f3ff3e

Browse files
authored
Fix the meteorology bugs identified in issue (#571)
# CABLE Thank you for submitting a pull request to the CABLE Project. ## Description Identified some meteorology bugs that caused issues during the later spinup stages. Specific bugs are: * Incorrect year was retrieved for previous/next day met variables during spin-up * Calculation of length of year became incorrect over time due to implicit ```SAVE``` Fixes #[570](#570) ## Type of change - [x] Bug fix ## Testing This is not being pushed into the ```main``` branch.
1 parent e3b41aa commit 2f3ff3e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

offline/cable_cru_TRENDY.F90

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,9 @@ SUBROUTINE get_met_date(SimYear, SimDay, IsRecycled, RecycleStart,&
615615

616616
! We need to know how many days we expect in the year so check for end of year
617617
! behaviour
618-
INTEGER :: DaysInYear = 365
618+
INTEGER :: DaysInYear
619+
620+
DaysInYear = 365
619621

620622
! Set up the first pass at recycling
621623
MetYear = SimYear
@@ -639,15 +641,15 @@ SUBROUTINE get_met_date(SimYear, SimDay, IsRecycled, RecycleStart,&
639641
ELSEIF (SimDay < 1) THEN
640642
! Go back to last year- set the day later, once we know whether the MetYear
641643
! is a leapyear or not
642-
MetYear = SimYear - 1
644+
MetYear = MetYear - 1
643645

644646
! This handles any future scenarios where we may change the day by >1
645647
MetDay = 365 + SimDay
646648
IF ((LeapYears) .AND. is_leapyear(MetYear)) THEN
647649
MetDay = 366 + SimDay
648650
END IF
649651
ELSEIF (SimDay > DaysInYear) THEN
650-
MetYear = SimYear + 1
652+
MetYear = MetYear + 1
651653
MetDay = SimDay - DaysInYear
652654
ELSE
653655
MetDay = SimDay

0 commit comments

Comments
 (0)