Changeset 11942
- Timestamp:
- 2019-11-21T11:13:52+01:00 (5 years ago)
- Location:
- NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/cfgs/SHARED/grid_def_nemo.xml
r11922 r11942 58 58 <scalar/> 59 59 </grid> 60 <!-- grid definition for diamlr --> 60 <!-- grid definitions for multiple-linear-regression analysis (diamlr) --> 61 <grid id="diamlr_grid_scalar" > 62 <scalar /> 63 <scalar /> 64 </grid> 61 65 <grid id="diamlr_grid_2D" > 62 66 <domain domain_ref="grid_T" /> 63 67 <scalar /> 64 68 </grid> 69 <grid id="diamlr_grid_3D" > 70 <domain domain_ref="grid_T" /> 71 <axis axis_ref="deptht" /> 72 </grid> 73 <grid id="diamlr_grid_2D_to_3D" > 74 <domain domain_ref="grid_T" /> 75 <axis axis_ref="deptht"> 76 <duplicate_scalar /> 77 </axis> 78 </grid> 79 <grid id="diamlr_grid_2D_to_scalar" > 80 <scalar> 81 <reduce_domain operation="average" /> 82 </scalar> 83 <scalar /> 84 </grid> 65 85 66 86 </grid_definition> 67 -
NEMO/branches/2019/dev_r11879_ENHANCE-05_SimonM-Harmonic_Analysis/src/OCE/DIA/diamlr.F90
r11925 r11942 9 9 USE par_oce , ONLY : wp, jpi, jpj 10 10 USE in_out_manager , ONLY : lwp, numout, ln_timing 11 USE iom , ONLY : iom_put, iom_use 11 USE iom , ONLY : iom_put, iom_use, iom_update_file_name 12 12 USE dom_oce , ONLY : adatrj 13 13 USE timing , ONLY : timing_start, timing_stop … … 56 56 !!---------------------------------------------------------------------- 57 57 58 TYPE(xios_fieldgroup) :: slxhdl_fldgrp 59 TYPE(xios_filegroup) :: slxhdl_filgrp 58 TYPE(xios_fieldgroup) :: slxhdl_fldgrp 59 TYPE(xios_filegroup) :: slxhdl_filgrp 60 TYPE(xios_field), ALLOCATABLE, DIMENSION(:) :: slxhdl_regs, slxhdl_flds 61 TYPE(xios_field) :: slxhdl_fld 62 TYPE(xios_file) :: slxhdl_fil 63 LOGICAL :: slxatt_enabled 64 CHARACTER(LEN=256) :: slxatt_expr 65 CHARACTER(LEN=32) :: slxatt_name1, slxatt_name2 66 CHARACTER(LEN=32) :: slxatt_gridref, slxatt_fieldref 67 INTEGER, PARAMETER :: jpscanmax = 999 68 INTEGER :: ireg, ifld 69 CHARACTER(LEN=3) :: cl3i 70 CHARACTER(LEN=6) :: cl6a 71 CHARACTER(LEN=1) :: clgt 72 CHARACTER(LEN=2) :: clgd 73 INTEGER :: jm, jn 60 74 61 75 IF(lwp) THEN … … 70 84 IF ( lk_diamlr .AND. xios_is_valid_fieldgroup( "diamlr_fields" ) .AND. xios_is_valid_field( "diamlr_time" ) .AND. & 71 85 & xios_is_valid_filegroup( "diamlr_files" ) ) THEN 72 CALL xios_get_handle("diamlr_fields", 73 CALL xios_get_handle("diamlr_files", 86 CALL xios_get_handle("diamlr_fields", slxhdl_fldgrp) 87 CALL xios_get_handle("diamlr_files", slxhdl_filgrp) 74 88 ELSE 75 89 IF (lwp) THEN … … 81 95 END IF 82 96 97 ! Set up IOM context for multiple-linear-regression analysis 98 IF ( lk_diamlr ) THEN 99 100 ! Set up output files for grid types scalar, grid_T, grid_U, grid_V, 101 ! and grid_W 102 DO jm = 1, 5 103 SELECT CASE( jm ) 104 CASE( 1 ) 105 cl6a = 'scalar' 106 CASE( 2 ) 107 cl6a = 'grid_T' 108 CASE( 3 ) 109 cl6a = 'grid_U' 110 CASE( 4 ) 111 cl6a = 'grid_V' 112 CASE( 5 ) 113 cl6a = 'grid_W' 114 END SELECT 115 CALL xios_add_child ( slxhdl_filgrp, slxhdl_fil, "diamlr_file_"//cl6a ) 116 CALL xios_set_attr ( slxhdl_fil, name_suffix="_diamlr_"//cl6a, & 117 & description="Intermediary output for multiple-linear-regression analysis - "//cl6a ) 118 CALL iom_update_file_name( "diamlr_file_"//cl6a ) 119 END DO 120 121 ! Compile lists of active regressors and of fields selected for 122 ! analysis (fields "diamlr_r<nnn>" and "diamlr_f<nnn>", where <nnn> is 123 ! a 3-digit integer) 124 ALLOCATE( slxhdl_regs( jpscanmax ), slxhdl_flds( jpscanmax ) ) 125 ireg = 0 126 ifld = 0 127 DO jm = 1, jpscanmax 128 WRITE (cl3i, '(i3.3)') jm 129 130 ! Look for regressor 131 IF ( xios_is_valid_field( "diamlr_r"//cl3i ) ) THEN 132 CALL xios_get_handle( "diamlr_r"//cl3i, slxhdl_regs(ireg+1) ) 133 ! Set name attribute (and overwrite possible pre-configured name) 134 ! with field id to enable id string retrieval from stored handle 135 ! below 136 CALL xios_set_attr ( slxhdl_regs(ireg+1), name="diamlr_r"//cl3i ) 137 ! Retrieve pre-configured value of "enabled" attribute 138 CALL xios_get_attr ( slxhdl_regs(ireg+1), enabled=slxatt_enabled ) 139 ! If enabled, keep handle in list of activ regressors 140 IF ( slxatt_enabled ) ireg = ireg + 1 141 END IF 142 143 ! Look for field 144 IF ( xios_is_valid_field( "diamlr_f"//cl3i ) ) THEN 145 CALL xios_get_handle( "diamlr_f"//cl3i, slxhdl_flds(ifld+1) ) 146 ! Set name attribute (and overwrite possible pre-configured name) 147 ! with field id to enable id string retrieval from stored handle 148 ! below 149 CALL xios_set_attr ( slxhdl_flds(ifld+1), name="diamlr_f"//cl3i ) 150 ! Retrieve pre-configured value of "enabled" attribute 151 CALL xios_get_attr ( slxhdl_flds(ifld+1), enabled=slxatt_enabled ) 152 ! If enabled, keep handle in list of fields selected for analysis 153 IF ( slxatt_enabled ) ifld = ifld + 1 154 END IF 155 156 END DO 157 IF ( lwp ) WRITE(numout,'(a,i3,a)' ) 'diamlr: ', ireg, ' active regressors found' 158 IF ( lwp ) WRITE(numout,'(a,i3,a)' ) 'diamlr: ', ifld, ' fields selected for analysis' 159 160 ! For each active regressor: 161 DO jm = 1, ireg 162 163 ! i) set up 2-dimensional and 3-dimensional versions of the 164 ! regressors; explicitely set "enabled" attribute; note, while 165 ! the scalar versions of regressors are part of the 166 ! configuration, the respective 2-dimensional versions take 167 ! over the defining expression, while the scalar and 168 ! 3-dimensional versions are simply obtained via grid 169 ! transformations from the 2-dimensional version. 170 CALL xios_get_attr ( slxhdl_regs( jm ), name=slxatt_name1, expr=slxatt_expr, enabled=slxatt_enabled ) 171 CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( slxatt_name1 )//"_2D" ) 172 CALL xios_set_attr ( slxhdl_fld, expr=TRIM( slxatt_expr ), grid_ref="diamlr_grid_2D", & 173 & field_ref="diamlr_time", enabled=slxatt_enabled ) 174 CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( slxatt_name1 )//"_3D") 175 CALL xios_set_attr ( slxhdl_fld, expr="this", grid_ref="diamlr_grid_2D_to_3D", & 176 & field_ref=TRIM( slxatt_name1 )//"_2D", enabled=slxatt_enabled) 177 CALL xios_set_attr ( slxhdl_regs(jm), expr="this", grid_ref="diamlr_grid_2D_to_scalar", & 178 & field_ref=TRIM( slxatt_name1 )//"_2D", enabled=slxatt_enabled) 179 180 ! ii) set up definitions for the output of scalar products with 181 ! itself and with other active regressors 182 CALL xios_get_attr ( slxhdl_regs(jm), name=slxatt_name1 ) 183 CALL xios_get_handle( "diamlr_file_scalar", slxhdl_fil) 184 DO jn = 1, jm 185 ! Field for product between regressors 186 CALL xios_get_attr ( slxhdl_regs(jn), name=slxatt_name2, enabled=slxatt_enabled ) 187 CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( slxatt_name1 )//"."//TRIM( slxatt_name2 ) ) 188 ! Set appropriate name attribute to avoid the possibility of 189 ! using an inappropriate inherited name attribute as the variable 190 ! name in the output file 191 CALL xios_set_attr ( slxhdl_fld, name=TRIM( slxatt_name1 )//"."//TRIM( slxatt_name2 ), & 192 & grid_ref="diamlr_grid_scalar", expr="this * "//TRIM( slxatt_name2 ), & 193 & field_ref=TRIM( slxatt_name1 ), enabled=slxatt_enabled, operation="accumulate") 194 ! Add regressor-product field to output file 195 CALL xios_add_child ( slxhdl_fil, slxhdl_fld, TRIM( slxatt_name1 )//"."//TRIM( slxatt_name2 ) ) 196 END DO 197 198 ! iii) set up definitions for the output of scalar products with 199 ! fields selected for analysis 200 DO jn = 1, ifld 201 CALL xios_get_attr( slxhdl_flds(jn), name=slxatt_name2, grid_ref=slxatt_gridref, field_ref=slxatt_fieldref ) 202 clgt="T" 203 IF ( INDEX( slxatt_gridref, "_U_" ) > 0 ) clgt="U" 204 IF ( INDEX( slxatt_gridref, "_V_" ) > 0 ) clgt="V" 205 IF ( INDEX( slxatt_gridref, "_W_" ) > 0 ) clgt="W" 206 clgd="2D" 207 IF ( INDEX( slxatt_gridref, "_3D" ) > 0 ) clgd="3D" 208 CALL xios_add_child ( slxhdl_fldgrp, slxhdl_fld, TRIM( slxatt_name2 )//"."//TRIM( slxatt_name1 ) ) 209 ! Set appropriate name attribute to avoid the possibility of 210 ! using an inappropriate inherited name attribute as the variable 211 ! name in the output file 212 CALL xios_set_attr ( slxhdl_fld, name=TRIM( slxatt_name2 )//"."//TRIM( slxatt_name1 ), & 213 & expr="this * "//TRIM( slxatt_fieldref ), grid_ref="diamlr_grid_"//clgd, & 214 & field_ref=TRIM( slxatt_name1 )//"_"//clgd, enabled=slxatt_enabled, operation="accumulate" ) 215 CALL xios_get_handle( "diamlr_file_grid_"//clgt, slxhdl_fil ) 216 CALL xios_add_child ( slxhdl_fil, slxhdl_fld, TRIM( slxatt_name2 )//"."//TRIM( slxatt_name1 ) ) 217 END DO 218 219 END DO 220 221 END IF 222 223 ! Release list of active regressors and fields selected for analysis 224 DEALLOCATE( slxhdl_regs, slxhdl_flds ) 225 83 226 END SUBROUTINE dia_mlr_iom_init 84 227
Note: See TracChangeset
for help on using the changeset viewer.