From 823250bad7b4c65a2af9f3998cf3e510cf1e03c5 Mon Sep 17 00:00:00 2001 From: mlee03 Date: Tue, 3 Oct 2023 15:03:42 -0400 Subject: [PATCH] more test updates --- test_fms/interpolator/test_interpolator2.F90 | 29 ++++++++++++------- test_fms/interpolator/test_interpolator2.sh | 20 +++++-------- .../test_interpolator_write_climatology.inc | 22 +++++++------- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/test_fms/interpolator/test_interpolator2.F90 b/test_fms/interpolator/test_interpolator2.F90 index 1370179a97..92f1d407ac 100644 --- a/test_fms/interpolator/test_interpolator2.F90 +++ b/test_fms/interpolator/test_interpolator2.F90 @@ -47,8 +47,8 @@ program test_interpolator2 character(100), parameter :: ncfile='immadeup.o3.climatology.nc' !< fake climatology file. integer, parameter :: lkind=TEST_INTP_KIND_ - real(r8_kind), parameter :: tol=1.e-12_r8_kind !< the interpolation methods are not perfect. - !! Will not get perfectly agreeing answers + !> the interpolation methods are not perfect.Will not get perfectly agreeing answers + real(r8_kind) :: tol integer :: calendar_type !> climatology related variables and arrays (made up data) @@ -61,7 +61,7 @@ program test_interpolator2 real(TEST_INTP_KIND_), allocatable :: lon(:) !< climatology coordinates real(TEST_INTP_KIND_), allocatable :: latb(:) !< climatology coordinates real(TEST_INTP_KIND_), allocatable :: lonb(:) !< climatology coordinates - real(TEST_INTP_KIND_), allocatable :: clim_time (:) !< climatology time + real(r8_kind), allocatable :: clim_time (:) !< climatology time real(TEST_INTP_KIND_), allocatable :: pfull(:) !< climatology p level real(TEST_INTP_KIND_), allocatable :: phalf(:) !< climatology p half level real(TEST_INTP_KIND_), allocatable :: ozone(:,:,:,:) !< climatology ozone data @@ -87,18 +87,25 @@ program test_interpolator2 NAMELIST / test_interpolator_nml / test_daily_noleap, test_daily_julian, & test_yearly_noleap, test_yearly_julian, test_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) if(test_daily_noleap) & - write(*,"(////10x,a/////)") " ** DAILY FILE CAL NOLEAP ** DAILY FILE CAL NOLEAP ** DAILY FILE CAL NOLEAP **" + write(*,"(////10x,a,i0////)") & + " ** DAILY FILE CAL NOLEAP ** DAILY FILE CAL NOLEAP ** DAILY FILE CAL NOLEAP ** ", lkind if(test_daily_julian) & - write(*,"(////10x,a/////)") ' ** DAILY FILE CAL JULIAN ** DAILY FILE CAL JULIAN ** DAILY FILE CAL JULIAN **' + write(*,"(////10x,a,i0/////)") & + ' ** DAILY FILE CAL JULIAN ** DAILY FILE CAL JULIAN ** DAILY FILE CAL JULIAN ** ', lkind if(test_yearly_noleap) & - write(*,"(////10x,a/////)") ' ** YEARLY FILE CAL NOLEAP ** YEARLY FILE CAL NOLEAP ** YEARLY FILE CAL NOLEAP **' + write(*,"(////10x,a,i0/////)") & + ' ** YEARLY FILE CAL NOLEAP ** YEARLY FILE CAL NOLEAP ** YEARLY FILE CAL NOLEAP ** ', lkind if(test_yearly_julian) & - write(*,"(////10x,a/////)") ' ** YEARLY FILE CAL JULIAN ** YEARLY FILE CAL JULIAN ** YEARLY FILE CAL JULIAN **' + write(*,"(////10x,a,i0/////)") & + ' ** YEARLY FILE CAL JULIAN ** YEARLY FILE CAL JULIAN ** YEARLY FILE CAL JULIAN ** ', lkind if(test_no_time) & write(*,"(////10x,a/////)") " ** NO TIME AXIS ** NO TIME AXIS ** NO TIME AXIS **" @@ -108,16 +115,16 @@ program test_interpolator2 !> set data if(test_daily_noleap) then - call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=140, npfull_in=3, & + call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=240, npfull_in=3, & daily_in=.true., yearly_in=.false., noleap_in=.true.) else if(test_daily_julian) then - call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=140, npfull_in=3, & + call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=240, npfull_in=3, & daily_in=.true., yearly_in=.false., noleap_in=.false.) else if(test_yearly_noleap) then - call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=140, npfull_in=3, & + call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=240, npfull_in=3, & daily_in=.false., yearly_in=.true., noleap_in=.true.) else if(test_yearly_julian) then - call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=140, npfull_in=3, & + call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=240, npfull_in=3, & daily_in=.false., yearly_in=.true., noleap_in=.false.) else if(test_no_time) then call set_parameters(nlonlat_in=10, nlonlat_mod_in=10, ntime_in=0, npfull_in=3, & diff --git a/test_fms/interpolator/test_interpolator2.sh b/test_fms/interpolator/test_interpolator2.sh index 2bd541d2cf..26377b2191 100755 --- a/test_fms/interpolator/test_interpolator2.sh +++ b/test_fms/interpolator/test_interpolator2.sh @@ -66,9 +66,9 @@ test_no_time=.false. / EOF mkdir -p INPUT -#test_expect_success "test_interpolator2 daily r4 julian unit tests" 'mpirun -n 1 ./test_interpolator2_r4' +test_expect_success "test_interpolator2 daily r4 julian unit tests" 'mpirun -n 1 ./test_interpolator2_r4' test_expect_success "test_interpolator2 daily r8 julian unit tests" 'mpirun -n 1 ./test_interpolator2_r8' -#rm -rf INPUT *.nc test_interpolator.nml +rm -rf INPUT *.nc test_interpolator.nml #Run the daily interpolator tests when the file calendar is in units of days and calendar type is JULIAN cat < test_interpolator.nml @@ -81,11 +81,9 @@ test_no_time=.false. / EOF mkdir -p INPUT -#test_expect_success "test_interpolator2 daily r4 noleap unit tests" 'mpirun -n 1 ./test_interpolator2_r4' +test_expect_success "test_interpolator2 daily r4 noleap unit tests" 'mpirun -n 1 ./test_interpolator2_r4' test_expect_success "test_interpolator2 daily r8 noleap unit tests" 'mpirun -n 1 ./test_interpolator2_r8' -#rm -rf INPUT *.nc test_interpolator.nml - -exit +rm -rf INPUT *.nc test_interpolator.nml #Run the yearly interpolator tests when the file calendar is in units of years and calendar type is NOLEAP cat < test_interpolator.nml @@ -100,7 +98,7 @@ EOF mkdir -p INPUT test_expect_success "test_interpolator2 yearly noleap r4 unit tests" 'mpirun -n 1 ./test_interpolator2_r4' test_expect_success "test_interpolator2 yearly noleap r8 unit tests" 'mpirun -n 1 ./test_interpolator2_r8' -#rm -rf INPUT *.nc test_interpolator.nml +rm -rf INPUT *.nc test_interpolator.nml #Run the yearly interpolator tests when the file calendar is in units of years and calendar type is JULIAN cat < test_interpolator.nml @@ -115,8 +113,7 @@ EOF mkdir -p INPUT test_expect_success "test_interpolator2 yearly julian r4 unit tests" 'mpirun -n 1 ./test_interpolator2_r4' test_expect_success "test_interpolator2 yearly julian r8 unit tests" 'mpirun -n 1 ./test_interpolator2_r8' -#rm -rf INPUT *.nc test_interpolator.nml - +rm -rf INPUT *.nc test_interpolator.nml #Run no_time_axis cat < test_interpolator.nml @@ -131,9 +128,6 @@ EOF mkdir -p INPUT test_expect_success "test_interpolator2 no time axis r4 unit tests" 'mpirun -n 1 ./test_interpolator2_r4' test_expect_success "test_interpolator2 no time axis r8 unit tests" 'mpirun -n 1 ./test_interpolator2_r8' -#rm -rf INPUT *.nc test_interpolator.nml - - +rm -rf INPUT *.nc test_interpolator.nml -#rm *.nml test_done diff --git a/test_fms/interpolator/test_interpolator_write_climatology.inc b/test_fms/interpolator/test_interpolator_write_climatology.inc index 3c5d0ddc19..4e792bda94 100644 --- a/test_fms/interpolator/test_interpolator_write_climatology.inc +++ b/test_fms/interpolator/test_interpolator_write_climatology.inc @@ -198,7 +198,7 @@ subroutine set_clim_time() dy = 15 model_time_julian(i)=set_date_julian(yr, mo, dy, hr, mn, sc) model_time_noleap(i)=set_date_no_leap(yr, mo, dy, hr, mn, sc) - clim_time(i)=time_type_to_real(model_time_noleap(i)-base_time)/86400._lkind + clim_time(i)=time_type_to_real(model_time_noleap(i)-base_time)/86400._r8_kind !call print_time(model_time_noleap(i)) end do else if(test_daily_julian) then @@ -210,7 +210,7 @@ subroutine set_clim_time() dy = 15 model_time_julian(i)=set_date_julian(yr, mo, dy, hr, mn, sc) model_time_noleap(i)=set_date_no_leap(yr, mo, dy, hr, mn, sc) - clim_time(i)=time_type_to_real(model_time_julian(i)-base_time)/86400._lkind + clim_time(i)=time_type_to_real(model_time_julian(i)-base_time)/86400._r8_kind !call print_time(model_time_julian(i)) end do else if(test_yearly_noleap) then @@ -222,15 +222,15 @@ subroutine set_clim_time() dy = 15 model_time_julian(i)=set_date_julian(yr, mo, dy, hr, mn, sc) model_time_noleap(i)=set_date_no_leap(yr, mo, dy, hr, mn, sc) - clim_time(i)=real(yr-1849,lkind) + clim_time(i)=real(yr-1849,r8_kind) do ii=1, mo-1 select case(ii) - case(1,3,5,7,8,10,12) ; clim_time(i) = clim_time(i) + 31.0_lkind/365._lkind - case(2) ; clim_time(i) = clim_time(i) + real(28,lkind)/365._lkind - case(4,6,9,11) ; clim_time(i) = clim_time(i) + 30.0_lkind/365._lkind + case(1,3,5,7,8,10,12) ; clim_time(i) = clim_time(i) + 31.0_r8_kind/365._r8_kind + case(2) ; clim_time(i) = clim_time(i) + 28._r8_kind/365._r8_kind + case(4,6,9,11) ; clim_time(i) = clim_time(i) + 30.0_r8_kind/365._r8_kind end select end do - clim_time(i) = clim_time(i) + real(dy-1)/real(365,lkind) + clim_time(i) = clim_time(i) + real(dy-1,r8_kind)/365._r8_kind !call print_time(model_time_noleap(i)) end do else if(test_yearly_julian) then @@ -247,12 +247,12 @@ subroutine set_clim_time() l=0 ; if(leap_year(model_time_julian(i))) l=l+1 do ii=1, mo-1 select case(ii) - case(1,3,5,7,8,10,12) ; clim_time(i) = clim_time(i) + 31.0_lkind/real(365+l,lkind) - case(2) ; clim_time(i) = clim_time(i) + real(28+l,lkind)/real(365+l,lkind) - case(4,6,9,11) ; clim_time(i) = clim_time(i) + 30.0_lkind/real(365+l,lkind) + case(1,3,5,7,8,10,12) ; clim_time(i) = clim_time(i) + 31.0_r8_kind/real(365+l,r8_kind) + case(2) ; clim_time(i) = clim_time(i) + real(28+l,r8_kind)/real(365+l,r8_kind) + case(4,6,9,11) ; clim_time(i) = clim_time(i) + 30.0_r8_kind/real(365+l,r8_kind) end select end do - clim_time(i) = clim_time(i) + real(dy-1)/real(365+l,lkind) + clim_time(i) = clim_time(i) + real(dy-1,r8_kind)/real(365+l,r8_kind) !call print_time(model_time_julian(i)) end do call set_calendar_type(0)