Skip to content

Commit

Permalink
fix: time calculation in interpolator updates (#1429)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored Dec 19, 2023
1 parent ac0d086 commit 38bfde3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
8 changes: 2 additions & 6 deletions interpolator/include/interpolator.inc
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,7 @@ if(dimension_exists(fileobj, "time")) then
! convert file times from noleap to julian.
!---------------------------------------------------------------------
else if ( (model_calendar == JULIAN .and. trim(adjustl(lowercase(file_calendar))) == 'noleap')) then
Noleap_time = set_time( INT((time_in(n)-real(INT(time_in(n)),r8_kind))*SECONDS_PER_DAY), &
INT(time_in(n))) + base_time
!Noleap_time = set_time (0, INT(time_in(n))) + base_time
Noleap_time = set_time (0, INT(time_in(n))) + base_time
call get_date_no_leap (Noleap_time, yr, mo, dy, hr, mn, sc)
clim_type%time_slice(n) = set_date_julian (yr, mo, dy, hr, mn, sc)
if (n == 1) then
Expand All @@ -554,9 +552,7 @@ if(dimension_exists(fileobj, "time")) then
! convert file times from julian to noleap.
!---------------------------------------------------------------------
else if ( (model_calendar == NOLEAP .and. trim(adjustl(lowercase(file_calendar))) == 'julian')) then
Julian_time = set_time( INT( (time_in(n)-real(INT(time_in(n)),r8_kind))*SECONDS_PER_DAY), &
INT(time_in(n))) + base_time
!Julian_time = set_time (0, INT(time_in(n))) + base_time
Julian_time = set_time (0, INT(time_in(n))) + base_time
call get_date_julian (Julian_time, yr, mo, dy, hr, mn, sc)
clim_type%time_slice(n) = set_date_no_leap (yr, mo, dy,hr, mn, sc)
if (n == 1) then
Expand Down
5 changes: 1 addition & 4 deletions test_fms/interpolator/test_interpolator2.F90
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ program test_interpolator2
character(100), parameter :: ncfile='immadeup.o3.climatology.nc' !< fake climatology file
integer, parameter :: lkind=TEST_INTP_KIND_
!> the interpolation methods are not perfect.Will not get perfectly agreeing answers
real(r8_kind) :: tol
real(r8_kind), parameter :: tol=0.1_lkind
integer :: calendar_type

!> climatology related variables and arrays (made up data)
Expand Down Expand Up @@ -90,9 +90,6 @@ program test_interpolator2
NAMELIST / test_interpolator_nml / test_file_daily_noleap, test_file_daily_julian, &
test_file_yearly_noleap, test_file_yearly_julian, test_file_no_time

if(lkind==r4_kind) tol=1.e-4_r8_kind
if(lkind==r8_kind) tol=1.e-6_r8_kind

open(unit=nml_unit_var, file=nml_file)
read(unit=nml_unit_var, nml=test_interpolator_nml)
close(nml_unit_var)
Expand Down

0 comments on commit 38bfde3

Please sign in to comment.