1 | MODULE diamlr |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE diamlr *** |
---|
4 | !! Management of the IOM context for multiple-linear-regression analysis |
---|
5 | !!====================================================================== |
---|
6 | !! History : ! 2019 (S. Mueller) |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | |
---|
9 | USE par_oce , ONLY : wp, jpi, jpj |
---|
10 | USE in_out_manager , ONLY : lwp, numout, ln_timing |
---|
11 | USE iom , ONLY : iom_put, iom_use |
---|
12 | USE dom_oce , ONLY : adatrj |
---|
13 | USE timing , ONLY : timing_start, timing_stop |
---|
14 | USE xios |
---|
15 | |
---|
16 | IMPLICIT NONE |
---|
17 | PRIVATE |
---|
18 | |
---|
19 | LOGICAL, PUBLIC :: lk_diamlr = .FALSE. |
---|
20 | |
---|
21 | PUBLIC :: dia_mlr_init, dia_mlr_iom_init, dia_mlr |
---|
22 | |
---|
23 | !!---------------------------------------------------------------------- |
---|
24 | !! NEMO/OCE 4.0 , NEMO Consortium (2019) |
---|
25 | !! $Id$ |
---|
26 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
27 | !!---------------------------------------------------------------------- |
---|
28 | CONTAINS |
---|
29 | |
---|
30 | SUBROUTINE dia_mlr_init |
---|
31 | !!---------------------------------------------------------------------- |
---|
32 | !! *** ROUTINE dia_mlr_init *** |
---|
33 | !! |
---|
34 | !! ** Purpose : initialisation of IOM context management for |
---|
35 | !! multiple-linear-regression analysis |
---|
36 | !! |
---|
37 | !!---------------------------------------------------------------------- |
---|
38 | |
---|
39 | lk_diamlr = .TRUE. |
---|
40 | |
---|
41 | IF(lwp) THEN |
---|
42 | WRITE(numout, *) |
---|
43 | WRITE(numout, *) 'dia_mlr_init : initialisation of IOM context management for' |
---|
44 | WRITE(numout, *) '~~~~~~~~~~~~ multiple-linear-regression analysis' |
---|
45 | END IF |
---|
46 | |
---|
47 | END SUBROUTINE dia_mlr_init |
---|
48 | |
---|
49 | SUBROUTINE dia_mlr_iom_init |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | !! *** ROUTINE dia_mlr_iom_init *** |
---|
52 | !! |
---|
53 | !! ** Purpose : IOM context setup for multiple-linear-regression |
---|
54 | !! analysis |
---|
55 | !! |
---|
56 | !!---------------------------------------------------------------------- |
---|
57 | |
---|
58 | TYPE(xios_fieldgroup) :: slxhdl_fldgrp |
---|
59 | TYPE(xios_filegroup) :: slxhdl_filgrp |
---|
60 | |
---|
61 | IF(lwp) THEN |
---|
62 | WRITE(numout, *) |
---|
63 | WRITE(numout, *) 'dia_mlr_iom_init : IOM context setup for multiple-linear-regression' |
---|
64 | WRITE(numout, *) '~~~~~~~~~~~~~~~~' |
---|
65 | END IF |
---|
66 | |
---|
67 | ! Get handles to multiple-linear-regression analysis configuration (field |
---|
68 | ! group 'diamrl_fields' and file group 'diamlr_files'); if no suitable |
---|
69 | ! configuration is found, disable diamlr |
---|
70 | IF ( lk_diamlr .AND. xios_is_valid_fieldgroup( "diamlr_fields" ) .AND. xios_is_valid_field( "diamlr_time" ) .AND. & |
---|
71 | & xios_is_valid_filegroup( "diamlr_files" ) ) THEN |
---|
72 | CALL xios_get_handle("diamlr_fields", slxhdl_fldgrp) |
---|
73 | CALL xios_get_handle("diamlr_files", slxhdl_filgrp) |
---|
74 | ELSE |
---|
75 | IF (lwp) THEN |
---|
76 | WRITE(numout, *) "diamlr: configuration not found or icomplete (field group 'diamlr_fields'" |
---|
77 | WRITE(numout, *) " and/or file group 'diamlr_files' and/or field 'diamlr_time' missing);" |
---|
78 | WRITE(numout, *) " disabling output for multiple-linear-regression analysis." |
---|
79 | END IF |
---|
80 | lk_diamlr = .FALSE. |
---|
81 | END IF |
---|
82 | |
---|
83 | END SUBROUTINE dia_mlr_iom_init |
---|
84 | |
---|
85 | SUBROUTINE dia_mlr |
---|
86 | !!---------------------------------------------------------------------- |
---|
87 | !! *** ROUTINE dia_mlr *** |
---|
88 | !! |
---|
89 | !! ** Purpose : update time used in multiple-linear-regression analysis |
---|
90 | !! |
---|
91 | !!---------------------------------------------------------------------- |
---|
92 | |
---|
93 | REAL, DIMENSION(jpi,jpj) :: zadatrj2d |
---|
94 | |
---|
95 | IF( ln_timing ) CALL timing_start('dia_mlr') |
---|
96 | |
---|
97 | ! Update time to the continuous time since the start of the model run |
---|
98 | ! (value of adatrj converted to time in units of seconds) |
---|
99 | ! |
---|
100 | ! A 2-dimensional field of constant value is sent, and subsequently used |
---|
101 | ! directly or transformed to a scalar or a constant 3-dimensional field as |
---|
102 | ! required. |
---|
103 | zadatrj2d(:,:) = adatrj*86400.0_wp |
---|
104 | IF ( iom_use('diamlr_time') ) CALL iom_put('diamlr_time', zadatrj2d) |
---|
105 | |
---|
106 | IF( ln_timing ) CALL timing_stop('dia_mlr') |
---|
107 | |
---|
108 | END SUBROUTINE dia_mlr |
---|
109 | |
---|
110 | END MODULE diamlr |
---|