Testing: Fortran julian date conversions

This commit is contained in:
Shahram Najm 2023-08-11 15:49:28 +01:00
parent a7f2d559ea
commit 94b428d997
3 changed files with 50 additions and 0 deletions

View File

@ -9,6 +9,7 @@ configure_file( include.ctest.sh.in include.ctest.sh @ONLY )
if( HAVE_BUILD_TOOLS )
list( APPEND tests_sanity
codes_ecc-1392
codes_datetime_julian
grib_set_pv
grib_set_data
bufr_ecc-1284

View File

@ -0,0 +1,34 @@
! (C) Copyright 2005- ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
!
!
program codes_datetime_julian
use eccodes
implicit none
integer(kind=8) :: year=2012, month=1, day=2, hour=13, min=0, sec=48
integer(kind=8) :: year2, month2, day2, hour2, min2, sec2
real(kind=8) :: julian
CALL codes_datetime_to_julian(year, month, day, hour, min, sec, julian)
PRINT *, 'datetime to julian ', julian
CALL codes_julian_to_datetime(julian, year2, month2, day2, hour2, min2, sec2)
PRINT *, 'julian to datetime ', year2, month2, day2, hour2, min2, sec2
IF (year /= year2) THEN
call codes_check(CODES_INTERNAL_ERROR, 'Error', 'Year is wrong')
END IF
IF (month /= month2) THEN
call codes_check(CODES_INTERNAL_ERROR, 'Error', 'Month is wrong')
END IF
IF (day /= day2) THEN
call codes_check(CODES_INTERNAL_ERROR, 'Error', 'Day is wrong')
END IF
end program codes_datetime_julian

View File

@ -0,0 +1,15 @@
#!/bin/sh
# (C) Copyright 2005- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
. ./include.ctest.sh
label="codes_datetime_julian_test_f"
${examples_dir}/eccodes_f_codes_datetime_julian