[2696] | 1 | !> @file tests/test-input-files.f90 |
---|
| 2 | !------------------------------------------------------------------------------! |
---|
[2718] | 3 | ! This file is part of the PALM model system. |
---|
[2696] | 4 | ! |
---|
[2718] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
[2696] | 8 | ! version. |
---|
| 9 | ! |
---|
[2718] | 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
[2696] | 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
[3785] | 17 | ! Copyright 2017-2019 Leibniz Universitaet Hannover |
---|
| 18 | ! Copyright 2017-2019 Deutscher Wetterdienst Offenbach |
---|
[2696] | 19 | !------------------------------------------------------------------------------! |
---|
| 20 | ! |
---|
| 21 | ! Current revisions: |
---|
| 22 | ! ----------------- |
---|
| 23 | ! |
---|
[3183] | 24 | ! |
---|
[2696] | 25 | ! Former revisions: |
---|
| 26 | ! ----------------- |
---|
| 27 | ! $Id: test-input-files.f90 3785 2019-03-06 10:41:14Z monakurppa $ |
---|
[3681] | 28 | ! Switched to get_datetime_file_list() |
---|
| 29 | ! |
---|
| 30 | ! |
---|
| 31 | ! 3678 2019-01-17 14:12:17Z eckhard |
---|
[3618] | 32 | ! Prefixed all INIFOR modules with inifor_ |
---|
| 33 | ! |
---|
| 34 | ! |
---|
| 35 | ! 3183 2018-07-27 14:25:55Z suehring |
---|
[3183] | 36 | ! New test for negative start_hour and greater-than-one step_hour |
---|
| 37 | ! |
---|
| 38 | ! |
---|
| 39 | ! 3182 2018-07-27 13:36:03Z suehring |
---|
[2696] | 40 | ! Initial revision |
---|
| 41 | ! |
---|
| 42 | ! |
---|
| 43 | ! |
---|
| 44 | ! Authors: |
---|
| 45 | ! -------- |
---|
| 46 | ! @author Eckhard Kadasch |
---|
| 47 | ! |
---|
| 48 | ! Description: |
---|
| 49 | ! ------------ |
---|
| 50 | !> This program tests INIFOR's timestamping used for generating input file |
---|
| 51 | !> names. |
---|
| 52 | !------------------------------------------------------------------------------! |
---|
| 53 | PROGRAM test_input_files |
---|
| 54 | |
---|
[3618] | 55 | USE inifor_defs, & |
---|
[2696] | 56 | ONLY : PATH |
---|
[3678] | 57 | USE inifor_io, & |
---|
| 58 | ONLY : get_datetime_file_list |
---|
[2696] | 59 | USE test_utils |
---|
| 60 | |
---|
| 61 | IMPLICIT NONE |
---|
| 62 | |
---|
[3182] | 63 | CHARACTER(LEN=60) :: title |
---|
[2696] | 64 | CHARACTER(LEN=PATH), ALLOCATABLE, DIMENSION(:) :: file_list, ref_list |
---|
| 65 | LOGICAL :: res |
---|
[3182] | 66 | INTEGER :: i |
---|
[2696] | 67 | |
---|
| 68 | title = "input files - daylight saving to standard time" |
---|
| 69 | CALL begin_test(title, res) |
---|
| 70 | |
---|
| 71 | ! Arange |
---|
| 72 | ! ...a date range that inlcudes a shift from daylight saving time to |
---|
| 73 | ! standard time (29.10.2017). Since all time stamps in COSMO-DE input files |
---|
| 74 | ! are in UTC, this should not the naming cadence. |
---|
| 75 | ALLOCATE( ref_list(6) ) |
---|
| 76 | ref_list(1) = './laf2017102823-test.nc' |
---|
| 77 | ref_list(2) = './laf2017102900-test.nc' |
---|
| 78 | ref_list(3) = './laf2017102901-test.nc' |
---|
| 79 | ref_list(4) = './laf2017102902-test.nc' |
---|
| 80 | ref_list(5) = './laf2017102903-test.nc' |
---|
| 81 | ref_list(6) = './laf2017102904-test.nc' |
---|
| 82 | |
---|
| 83 | ! Act |
---|
[3678] | 84 | CALL get_datetime_file_list(start_date_string='2017102823', & |
---|
| 85 | start_hour=0, end_hour=5, step_hour=1, & |
---|
| 86 | input_path='./', prefix="laf", suffix='-test', & |
---|
| 87 | file_list=file_list) |
---|
[2696] | 88 | |
---|
| 89 | ! Assert |
---|
| 90 | DO i = 1, 6 |
---|
| 91 | res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i))) |
---|
[3785] | 92 | ENDDO |
---|
[2696] | 93 | |
---|
| 94 | DEALLOCATE( ref_list, file_list ) |
---|
| 95 | CALL end_test(title, res) |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | title = "input files - leap day" |
---|
| 99 | CALL begin_test(title, res) |
---|
| 100 | |
---|
| 101 | ! Arange |
---|
| 102 | ! ...a date range that inlcudes a leap day (29. Feb. 2016) which should be |
---|
| 103 | ! inlcuded in UTC time stamps. |
---|
| 104 | ALLOCATE( ref_list(2) ) |
---|
| 105 | ref_list(1) = './laf2016022823-test.nc' |
---|
| 106 | ref_list(2) = './laf2016022900-test.nc' |
---|
| 107 | |
---|
| 108 | ! Act |
---|
[3678] | 109 | CALL get_datetime_file_list(start_date_string='2016022823', & |
---|
| 110 | start_hour=0, end_hour=1, step_hour=1, & |
---|
| 111 | input_path='./', prefix="laf", suffix='-test', & |
---|
| 112 | file_list=file_list) |
---|
[2696] | 113 | |
---|
| 114 | ! Assert |
---|
| 115 | DO i = 1, 2 |
---|
| 116 | res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i))) |
---|
[3785] | 117 | ENDDO |
---|
[2696] | 118 | |
---|
| 119 | DEALLOCATE( ref_list, file_list ) |
---|
| 120 | CALL end_test(title, res) |
---|
| 121 | |
---|
[3182] | 122 | |
---|
| 123 | |
---|
| 124 | title = "input files - negative start_hour and step_hour > 1 hour" |
---|
| 125 | CALL begin_test(title, res) |
---|
| 126 | |
---|
| 127 | ! Arange |
---|
| 128 | ! ...a date range that inlcudes a leap day (29. Feb. 2016) which should be |
---|
| 129 | ! inlcuded in UTC time stamps. |
---|
| 130 | ALLOCATE( ref_list(4) ) |
---|
| 131 | ref_list(1) = './laf2017102823-test.nc' |
---|
| 132 | ref_list(2) = './laf2017102901-test.nc' |
---|
| 133 | ref_list(3) = './laf2017102903-test.nc' |
---|
| 134 | ref_list(4) = './laf2017102904-test.nc' |
---|
| 135 | |
---|
| 136 | ! Act |
---|
[3678] | 137 | CALL get_datetime_file_list(start_date_string='2017102901', & |
---|
| 138 | start_hour=-2, end_hour=3, step_hour=2, & |
---|
| 139 | input_path='./', prefix="laf", suffix='-test', & |
---|
| 140 | file_list=file_list) |
---|
[3182] | 141 | |
---|
| 142 | PRINT *, file_list |
---|
| 143 | |
---|
| 144 | ! Assert |
---|
| 145 | DO i = 1, 2 |
---|
| 146 | res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i))) |
---|
[3785] | 147 | ENDDO |
---|
[3182] | 148 | |
---|
| 149 | DEALLOCATE( ref_list, file_list ) |
---|
| 150 | CALL end_test(title, res) |
---|
| 151 | |
---|
[2696] | 152 | END PROGRAM test_input_files |
---|