source: NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA/diamlr.F90 @ 11925

Last change on this file since 11925 was 11925, checked in by smueller, 11 months ago

Extension of the test for the existence of a regression-analysis configuration in the IOM context setup for multiple-linear-regression analysis (ticket #2175)

File size: 4.3 KB
RevLine 
[11910]1MODULE diamlr
2   !!======================================================================
3   !!                       ***  MODULE  diamlr  ***
4   !! Management of the IOM context for multiple-linear-regression analysis
5   !!======================================================================
6   !! History :       !  2019  (S. Mueller)
7   !!----------------------------------------------------------------------
8
[11922]9   USE par_oce        , ONLY :   wp, jpi, jpj
[11910]10   USE in_out_manager , ONLY :   lwp, numout, ln_timing
[11922]11   USE iom            , ONLY :   iom_put, iom_use
12   USE dom_oce        , ONLY :   adatrj
[11910]13   USE timing         , ONLY :   timing_start, timing_stop
[11921]14   USE xios
[11910]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   !!----------------------------------------------------------------------
28CONTAINS
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
[11921]58      TYPE(xios_fieldgroup)  ::   slxhdl_fldgrp
[11925]59      TYPE(xios_filegroup)   ::   slxhdl_filgrp
[11921]60
[11910]61      IF(lwp) THEN
62         WRITE(numout, *)
63         WRITE(numout, *) 'dia_mlr_iom_init : IOM context setup for multiple-linear-regression'
[11911]64         WRITE(numout, *) '~~~~~~~~~~~~~~~~'
[11910]65      END IF
66
[11925]67      ! Get handles to multiple-linear-regression analysis configuration (field
68      ! group 'diamrl_fields' and file group 'diamlr_files'); if no suitable
[11921]69      ! configuration is found, disable diamlr
[11925]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
[11921]72         CALL xios_get_handle("diamlr_fields",  slxhdl_fldgrp)
[11925]73         CALL xios_get_handle("diamlr_files",   slxhdl_filgrp)
[11921]74      ELSE
75         IF (lwp) THEN
[11925]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);"
[11921]78            WRITE(numout, *) "        disabling output for multiple-linear-regression analysis."
79         END IF
80         lk_diamlr = .FALSE.
81      END IF
82
[11910]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
[11922]93      REAL, DIMENSION(jpi,jpj) ::   zadatrj2d
94
[11910]95      IF( ln_timing )   CALL timing_start('dia_mlr')
96
[11922]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)
[11910]105     
106      IF( ln_timing )   CALL timing_stop('dia_mlr')
107
108   END SUBROUTINE dia_mlr
109
110END MODULE diamlr
Note: See TracBrowser for help on using the repository browser.