source: palm/trunk/UTIL/inifor/tests/test-input-files.f90 @ 3618

Last change on this file since 3618 was 3618, checked in by eckhard, 6 years ago

inifor: Prefixed all INIFOR modules with inifor_ and removed unused variables

  • Property svn:keywords set to Id
File size: 4.8 KB
RevLine 
[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!
[2718]17! Copyright 2017-2018 Leibniz Universitaet Hannover
18! Copyright 2017-2018 Deutscher Wetterdienst Offenbach
[2696]19!------------------------------------------------------------------------------!
20!
21! Current revisions:
22! -----------------
23!
[3183]24!
[2696]25! Former revisions:
26! -----------------
27! $Id: test-input-files.f90 3618 2018-12-10 13:25:22Z eckhard $
[3618]28! Prefixed all INIFOR modules with inifor_
29!
30!
31! 3183 2018-07-27 14:25:55Z suehring
[3183]32! New test for negative start_hour and greater-than-one step_hour
33!
34!
35! 3182 2018-07-27 13:36:03Z suehring
[2696]36! Initial revision
37!
38!
39!
40! Authors:
41! --------
42! @author Eckhard Kadasch
43!
44! Description:
45! ------------
46!> This program tests INIFOR's timestamping used for generating input file
47!> names.
48!------------------------------------------------------------------------------!
49 PROGRAM test_input_files
50
[3618]51    USE inifor_defs,                                                           &
[2696]52        ONLY :  PATH
[3618]53    USE inifor_grid,                                                           &
[3182]54        ONLY :  get_input_file_list
[2696]55    USE test_utils
56   
57    IMPLICIT NONE
58
[3182]59    CHARACTER(LEN=60)                              ::  title
[2696]60    CHARACTER(LEN=PATH), ALLOCATABLE, DIMENSION(:) ::  file_list, ref_list
61    LOGICAL                                        ::  res
[3182]62    INTEGER                                        ::  i
[2696]63
64    title = "input files - daylight saving to standard time"
65    CALL begin_test(title, res)
66
67    ! Arange
68    ! ...a date range that inlcudes a shift from daylight saving time to
69    ! standard time (29.10.2017). Since all time stamps in COSMO-DE input files
70    ! are in UTC, this should not the naming cadence.
71    ALLOCATE( ref_list(6) )
72    ref_list(1)  = './laf2017102823-test.nc'
73    ref_list(2)  = './laf2017102900-test.nc'
74    ref_list(3)  = './laf2017102901-test.nc'
75    ref_list(4)  = './laf2017102902-test.nc'
76    ref_list(5)  = './laf2017102903-test.nc'
77    ref_list(6)  = './laf2017102904-test.nc'
78
79    ! Act
[3182]80    CALL get_input_file_list(start_date_string='2017102823',                   &
81                             start_hour=0, end_hour=5, step_hour=1,            &
82                             path='./', prefix="laf", suffix='-test',          &
83                             file_list=file_list)
[2696]84
85    ! Assert
86    DO i = 1, 6
87       res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
88    END DO
89
90    DEALLOCATE( ref_list, file_list )
91    CALL end_test(title, res)
92
93
94    title = "input files - leap day"
95    CALL begin_test(title, res)
96
97    ! Arange
98    ! ...a date range that inlcudes a leap day (29. Feb. 2016) which should be
99    ! inlcuded in UTC time stamps.
100    ALLOCATE( ref_list(2) )
101    ref_list(1)  = './laf2016022823-test.nc'
102    ref_list(2)  = './laf2016022900-test.nc'
103
104    ! Act
[3182]105    CALL get_input_file_list(start_date_string='2016022823',                   &
106                             start_hour=0, end_hour=1, step_hour=1,            &
107                             path='./', prefix="laf", suffix='-test',          &
108                             file_list=file_list)
[2696]109
110    ! Assert
111    DO i = 1, 2
112       res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
113    END DO
114
115    DEALLOCATE( ref_list, file_list )
116    CALL end_test(title, res)
117
[3182]118
119
120    title = "input files - negative start_hour and step_hour > 1 hour"
121    CALL begin_test(title, res)
122
123    ! Arange
124    ! ...a date range that inlcudes a leap day (29. Feb. 2016) which should be
125    ! inlcuded in UTC time stamps.
126    ALLOCATE( ref_list(4) )
127    ref_list(1)  = './laf2017102823-test.nc'
128    ref_list(2)  = './laf2017102901-test.nc'
129    ref_list(3)  = './laf2017102903-test.nc'
130    ref_list(4)  = './laf2017102904-test.nc'
131
132    ! Act
133    CALL get_input_file_list(start_date_string='2017102901',                   &
134                             start_hour=-2, end_hour=3, step_hour=2,           &
135                             path='./', prefix="laf", suffix='-test',          &
136                             file_list=file_list)
137
138    PRINT *, file_list
139
140    ! Assert
141    DO i = 1, 2
142       res = res .AND. (TRIM(ref_list(i)) .EQ. TRIM(file_list(i)))
143    END DO
144
145    DEALLOCATE( ref_list, file_list )
146    CALL end_test(title, res)
147
[2696]148 END PROGRAM test_input_files
Note: See TracBrowser for help on using the repository browser.