source: palm/trunk/UTIL/inifor/tests/test-transform.f90 @ 4512

Last change on this file since 4512 was 4481, checked in by maronga, 5 years ago

Bugfix for copyright updates in document_changes; copyright update applied to all files

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1!> @file tests/test-transform.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
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
8! version.
9!
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.
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!
17! Copyright 2017-2020 Leibniz Universitaet Hannover
18! Copyright 2017-2020 Deutscher Wetterdienst Offenbach
19!------------------------------------------------------------------------------!
20!
21! Current revisions:
22! -----------------
23!
24!
25! Former revisions:
26! -----------------
27! $Id: test-transform.f90 4481 2020-03-31 18:55:54Z monakurppa $
28! Prefixed all modules with inifor_
29!
30!
31! 2718 2018-01-02 08:49:38Z maronga
32! Initial revision
33!
34!
35!
36! Authors:
37! --------
38! @author Eckhard Kadasch
39!
40! Description:
41! ------------
42!> This program tests INIFOR's rotated-pole coordinate transforms.
43!------------------------------------------------------------------------------!
44 PROGRAM test_transform
45
46    USE inifor_defs,                                                           &
47        ONLY :  TO_RADIANS, TO_DEGREES
48    USE inifor_grid,                                                           &
49        ONLY :  grid_definition, init_grid_definition
50    USE inifor_transform,                                                      &
51        ONLY :  phi2phirot, rla2rlarot, phirot2phi, rlarot2rla
52    USE test_utils
53   
54    IMPLICIT NONE
55
56    CHARACTER(LEN=30) ::  title
57    LOGICAL           ::  res
58
59    REAL, PARAMETER ::  lx = 100., ly = 200., lz = 300.
60
61    ! Angels in degrees
62    REAL ::  phi, lambda, phi_c, lambda_c, phi2, lambda2, phi_n, lambda_n
63
64    title = "rotation north-east"
65    CALL begin_test(title, res)
66    ! Arange
67    phi    = 52.5166670000000000
68    lambda = 13.3833330000000000
69
70    phi_n    =   40.
71    lambda_n = -170.
72
73    ! Act
74    phi_c     = phi2phirot(phi,   lambda, phi_n, lambda_n)
75    lambda_c  = rla2rlarot(phi,   lambda, phi_n, lambda_n, 0.)
76
77    phi2      = phirot2phi(phi_c, lambda_c, phi_n, 0.)
78    lambda2   = rlarot2rla(phi_c, lambda_c, phi_n, lambda_n, 0.)
79
80    ! Assert
81    res = assert_equal( (/phi, lambda/), (/phi2, lambda2/),  "rotated grid transformations" )
82    PRINT *, " Angles before transformation:  ", phi, lambda
83    PRINT *, " and after back transformation: ", phi2, lambda2
84
85    CALL end_test(title, res)
86
87    title = "rotation south-west"
88    CALL begin_test(title, res)
89    ! Arange
90    phi    = 49.
91    lambda =  9.
92
93    phi_n    =   40.
94    lambda_n = -170.
95
96    ! Act
97    phi_c     = phi2phirot(phi,   lambda, phi_n, lambda_n)
98    lambda_c  = rla2rlarot(phi,   lambda, phi_n, lambda_n, 0.)
99
100    phi2      = phirot2phi(phi_c, lambda_c, phi_n, 0.)
101    lambda2   = rlarot2rla(phi_c, lambda_c, phi_n, lambda_n, 0.)
102
103    ! Assert
104    res = assert_equal( (/phi, lambda/), (/phi2, lambda2/),  "rotated grid transformations" )
105    PRINT *, " Angles before transformation:  ", phi, lambda
106    PRINT *, " and after back transformation: ", phi2, lambda2
107
108    CALL end_test(title, res)
109 END PROGRAM test_transform
Note: See TracBrowser for help on using the repository browser.