Index: utils/tools/SIREN/src/attribute.f90
===================================================================
--- utils/tools/SIREN/src/attribute.f90	(revision 9621)
+++ utils/tools/SIREN/src/attribute.f90	(revision 12080)
@@ -2,6 +2,4 @@
 ! NEMO system team, System and Interface for oceanic RElocable Nesting
 !----------------------------------------------------------------------
-!
-! MODULE: att
 !
 ! DESCRIPTION:
@@ -79,5 +77,5 @@
 !>
 !> @author J.Paul
-! REVISION HISTORY:
+!>
 !> @date November, 2013 - Initial Version
 !> @date November, 2014 
@@ -85,8 +83,11 @@
 !> @date September, 2015
 !> - manage useless (dummy) attributes
-!
-!> @note Software governed by the CeCILL licence     (./LICENSE)
+!> @date May, 2019
+!> - read number of element for each dummy array in configuration file
+!>
+!> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
 !----------------------------------------------------------------------
 MODULE att
+
    USE netcdf                          ! nf90 library
    USE global                          ! global variable
@@ -94,5 +95,7 @@
    USE logger                          ! log file manager
    USE fct                             ! basic useful function
+
    IMPLICIT NONE
+
    ! NOTE_avoid_public_variables_if_possible
 
@@ -100,5 +103,6 @@
    PUBLIC :: TATT       !< attribute structure
 
-   PRIVATE :: cm_dumatt !< dummy attribute array
+   PRIVATE :: im_ndumatt   !< number of elt in dummy attribute array
+   PRIVATE :: cm_dumatt    !< dummy attribute array
 
    ! function and subroutine
@@ -141,5 +145,6 @@
    END TYPE TATT
 
-   CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg), SAVE :: cm_dumatt !< dummy attribute
+   INTEGER(i4)                               , SAVE :: im_ndumatt !< number of elt in dummy attribute array
+   CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg), SAVE :: cm_dumatt  !< dummy attribute
 
    INTERFACE att_init
@@ -175,4 +180,7 @@
 
 CONTAINS
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__copy_arr(td_att) &
+         & RESULT(tf_att)      
    !-------------------------------------------------------------------
    !> @brief
@@ -196,10 +204,11 @@
    !> @return copy of input array of attribute structure
    !-------------------------------------------------------------------
-   FUNCTION att__copy_arr( td_att )
-      IMPLICIT NONE
-      ! Argument
-      TYPE(TATT), DIMENSION(:), INTENT(IN) :: td_att
-      ! function
-      TYPE(TATT), DIMENSION(SIZE(td_att(:))) :: att__copy_arr
+
+      IMPLICIT NONE
+
+      ! Argument
+      TYPE(TATT), DIMENSION(:)  , INTENT(IN) :: td_att
+      ! function
+      TYPE(TATT), DIMENSION(SIZE(td_att(:))) :: tf_att
 
       ! local variable
@@ -209,8 +218,11 @@
 
       DO ji=1,SIZE(td_att(:))
-         att__copy_arr(ji)=att_copy(td_att(ji))
+         tf_att(ji)=att_copy(td_att(ji))
       ENDDO
 
    END FUNCTION att__copy_arr
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__copy_unit(td_att) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief
@@ -235,10 +247,12 @@
    !> @return copy of input attribute structure
    !-------------------------------------------------------------------
-   FUNCTION att__copy_unit( td_att )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       TYPE(TATT), INTENT(IN)  :: td_att
-      ! function
-      TYPE(TATT) :: att__copy_unit
+
+      ! function
+      TYPE(TATT)              :: tf_att
 
       ! local variable
@@ -247,18 +261,18 @@
 
       ! copy attribute variable
-      att__copy_unit%c_name  = TRIM(td_att%c_name)
-      att__copy_unit%i_id    = td_att%i_id
-      att__copy_unit%i_type  = td_att%i_type
-      att__copy_unit%i_len   = td_att%i_len
-      att__copy_unit%c_value = TRIM(td_att%c_value)
+      tf_att%c_name  = TRIM(td_att%c_name)
+      tf_att%i_id    = td_att%i_id
+      tf_att%i_type  = td_att%i_type
+      tf_att%i_len   = td_att%i_len
+      tf_att%c_value = TRIM(td_att%c_value)
 
       ! copy attribute pointer in an independant variable
-      IF( ASSOCIATED(att__copy_unit%d_value) ) DEALLOCATE(att__copy_unit%d_value)
+      IF( ASSOCIATED(tf_att%d_value) ) DEALLOCATE(tf_att%d_value)
       IF( ASSOCIATED(td_att%d_value) )THEN
          ALLOCATE( dl_value(td_att%i_len) )
          dl_value(:) = td_att%d_value(:)
 
-         ALLOCATE( att__copy_unit%d_value(att__copy_unit%i_len) )
-         att__copy_unit%d_value(:) = dl_value(:)
+         ALLOCATE( tf_att%d_value(tf_att%i_len) )
+         tf_att%d_value(:) = dl_value(:)
 
          DEALLOCATE( dl_value )
@@ -266,4 +280,7 @@
 
    END FUNCTION att__copy_unit
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att_get_index(td_att, cd_name) &
+         & RESULT(if_idx)
    !-------------------------------------------------------------------
    !> @brief This function return attribute index, in a array of attribute structure,
@@ -279,10 +296,14 @@
    !> @return attribute index
    !-------------------------------------------------------------------
-   INTEGER(i4) FUNCTION att_get_index( td_att, cd_name )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       TYPE(TATT),       DIMENSION(:), INTENT(IN) :: td_att
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
 
+      ! function
+      INTEGER(i4)                                :: if_idx
+
       ! local variable
       INTEGER(i4) :: il_size
@@ -291,10 +312,10 @@
       INTEGER(i4) :: ji
       !----------------------------------------------------------------
-      att_get_index=0
+      if_idx=0
 
       il_size=SIZE(td_att(:))
       DO ji=1,il_size
          IF( TRIM(td_att(ji)%c_name) == TRIM(cd_name) )THEN
-            att_get_index=ji
+            if_idx=ji
             EXIT
          ENDIF
@@ -302,4 +323,7 @@
 
    END FUNCTION att_get_index
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att_get_id(td_att, cd_name) &
+         & RESULT (if_id)
    !-------------------------------------------------------------------
    !> @brief This function return attribute id, read from a file.<br/>
@@ -316,10 +340,14 @@
    !> @return attribute id
    !-------------------------------------------------------------------
-   INTEGER(i4) FUNCTION att_get_id( td_att, cd_name )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       TYPE(TATT),       DIMENSION(:), INTENT(IN) :: td_att
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
 
+      ! function
+      INTEGER(i4)                                :: if_id
+
       ! local variable
       INTEGER(i4) :: il_size
@@ -328,10 +356,10 @@
       INTEGER(i4) :: ji
       !----------------------------------------------------------------
-      att_get_id=0
+      if_id=0
 
       il_size=SIZE(td_att(:))
       DO ji=1,il_size
          IF( TRIM(td_att(ji)%c_name) == TRIM(cd_name) )THEN
-            att_get_id=td_att(ji)%i_id
+            if_id=td_att(ji)%i_id
             EXIT
          ENDIF
@@ -339,4 +367,7 @@
 
    END FUNCTION att_get_id
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_c(cd_name, cd_value) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with character
@@ -350,13 +381,17 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_c( cd_name, cd_value )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
       CHARACTER(LEN=*), INTENT(IN) :: cd_value
+
+      ! function
+      TYPE(TATT)                   :: tf_att
       !----------------------------------------------------------------
  
       ! clean attribute
-      CALL att_clean(att__init_c)
+      CALL att_clean(tf_att)
 
       CALL logger_trace( &
@@ -364,11 +399,14 @@
       &  " attribute value "//TRIM(ADJUSTL(cd_value)) )
 
-      att__init_c%c_name=TRIM(ADJUSTL(cd_name))
-      att__init_c%i_type=NF90_CHAR
-
-      att__init_c%c_value=TRIM(ADJUSTL(cd_value))
-      att__init_c%i_len=LEN( TRIM(ADJUSTL(cd_value)) )
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%i_type=NF90_CHAR
+
+      tf_att%c_value=TRIM(ADJUSTL(cd_value))
+      tf_att%i_len=LEN( TRIM(ADJUSTL(cd_value)) )
 
    END FUNCTION att__init_c
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_dp(cd_name, dd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -385,5 +423,5 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_dp( cd_name, dd_value, id_type )
+
       IMPLICIT NONE
 
@@ -393,4 +431,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -402,5 +443,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_dp)
+      CALL att_clean(tf_att)
 
       ! array size
@@ -417,21 +458,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )
 
-      att__init_dp%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_dp%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_dp%i_type=NF90_DOUBLE
-      ENDIF
-
-      IF( ASSOCIATED(att__init_dp%d_value) )THEN
-         DEALLOCATE(att__init_dp%d_value)
-      ENDIF
-      ALLOCATE(att__init_dp%d_value(il_len))
-
-      att__init_dp%d_value(:)=dd_value(:)
-      att__init_dp%i_len=il_len
+         tf_att%i_type=NF90_DOUBLE
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=dd_value(:)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_dp
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_dp_0d(cd_name, dd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -448,6 +492,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_dp_0d( cd_name, dd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -455,4 +500,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       ! local value
       CHARACTER(LEN=lc) :: cl_value
@@ -460,5 +508,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_dp_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(dd_value))//"/)"
@@ -468,21 +516,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )
 
-      att__init_dp_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_dp_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_dp_0d%i_type=NF90_DOUBLE
-      ENDIF
-
-      IF( ASSOCIATED(att__init_dp_0d%d_value) )THEN
-         DEALLOCATE(att__init_dp_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_dp_0d%d_value(1))
-
-      att__init_dp_0d%d_value(1)=dd_value
-      att__init_dp_0d%i_len=1
+         tf_att%i_type=NF90_DOUBLE
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=dd_value
+      tf_att%i_len=1
 
    END FUNCTION att__init_dp_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_sp(cd_name, rd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -499,6 +550,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_sp( cd_name, rd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
@@ -506,4 +558,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -515,5 +570,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_sp)
+      CALL att_clean(tf_att)
       
       ! array size
@@ -524,4 +579,7 @@
          cl_value=TRIM(cl_value)//TRIM(fct_str(rd_value(ji)))//","
       ENDDO
+      CALL logger_trace( &
+      &  " ATT INIT: attribute name: il_len "//fct_str(il_len)&
+      )
       cl_value=TRIM(cl_value)//TRIM(fct_str(rd_value(il_len)))//"/)"
 
@@ -530,21 +588,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_sp%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_sp%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_sp%i_type=NF90_FLOAT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_sp%d_value) )THEN
-         DEALLOCATE(att__init_sp%d_value)
-      ENDIF
-      ALLOCATE(att__init_sp%d_value(il_len))
-
-      att__init_sp%d_value(:)=REAL(rd_value(:),dp)
-      att__init_sp%i_len=il_len
+         tf_att%i_type=NF90_FLOAT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=REAL(rd_value(:),dp)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_sp
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_sp_0d(cd_name, rd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -561,6 +622,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_sp_0d( cd_name, rd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -568,4 +630,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       ! local value
       CHARACTER(LEN=lc) :: cl_value
@@ -573,5 +638,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_sp_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(rd_value))//"/)"
@@ -581,21 +646,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_sp_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_sp_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_sp_0d%i_type=NF90_FLOAT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_sp_0d%d_value) )THEN
-         DEALLOCATE(att__init_sp_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_sp_0d%d_value(1))
-
-      att__init_sp_0d%d_value(1)=REAL(rd_value,dp)
-      att__init_sp_0d%i_len=1
+         tf_att%i_type=NF90_FLOAT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=REAL(rd_value,dp)
+      tf_att%i_len=1
 
    END FUNCTION att__init_sp_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i1(cd_name, bd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -612,6 +680,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i1( cd_name, bd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
@@ -619,4 +688,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -628,5 +700,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i1)
+      CALL att_clean(tf_att)
       
       ! array size
@@ -643,21 +715,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i1%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i1%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i1%i_type=NF90_BYTE
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i1%d_value) )THEN
-         DEALLOCATE(att__init_i1%d_value)
-      ENDIF
-      ALLOCATE(att__init_i1%d_value(il_len))
-
-      att__init_i1%d_value(:)=REAL(bd_value(:),dp)
-      att__init_i1%i_len=il_len
+         tf_att%i_type=NF90_BYTE
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=REAL(bd_value(:),dp)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_i1
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i1_0d(cd_name, bd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -674,6 +749,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i1_0d( cd_name, bd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -681,4 +757,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       !local value
       CHARACTER(LEN=lc) :: cl_value
@@ -686,5 +765,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i1_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(bd_value))//"/)"
@@ -694,21 +773,24 @@
       &  " attibute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i1_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i1_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i1_0d%i_type=NF90_BYTE
+         tf_att%i_type=NF90_BYTE
       ENDIF      
 
-      IF( ASSOCIATED(att__init_i1_0d%d_value) )THEN
-         DEALLOCATE(att__init_i1_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_i1_0d%d_value(1))
-
-      att__init_i1_0d%d_value(1)=REAL(bd_value,dp)
-      att__init_i1_0d%i_len=1
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=REAL(bd_value,dp)
+      tf_att%i_len=1
 
    END FUNCTION att__init_i1_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i2(cd_name, sd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -725,6 +807,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i2( cd_name, sd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
@@ -732,4 +815,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -741,5 +827,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i2)
+      CALL att_clean(tf_att)
       
       ! array size
@@ -756,21 +842,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i2%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i2%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i2%i_type=NF90_SHORT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i2%d_value) )THEN
-         DEALLOCATE(att__init_i2%d_value)
-      ENDIF
-      ALLOCATE(att__init_i2%d_value(il_len))
-
-      att__init_i2%d_value(:)=REAL(sd_value(:),dp)
-      att__init_i2%i_len=il_len
+         tf_att%i_type=NF90_SHORT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=REAL(sd_value(:),dp)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_i2
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i2_0d(cd_name, sd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -787,6 +876,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i2_0d( cd_name, sd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -794,4 +884,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       !local value
       CHARACTER(LEN=lc) :: cl_value
@@ -799,5 +892,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i2_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(sd_value))//"/)"
@@ -807,21 +900,24 @@
       &  " attibute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i2_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i2_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i2_0d%i_type=NF90_SHORT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i2_0d%d_value) )THEN
-         DEALLOCATE(att__init_i2_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_i2_0d%d_value(1))
-
-      att__init_i2_0d%d_value(1)=REAL(sd_value,dp)
-      att__init_i2_0d%i_len=1
+         tf_att%i_type=NF90_SHORT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=REAL(sd_value,dp)
+      tf_att%i_len=1
 
    END FUNCTION att__init_i2_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i4(cd_name, id_value, id_type) &
+         & RESULT(tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -838,6 +934,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i4( cd_name, id_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
@@ -845,4 +942,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -854,5 +954,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i4)
+      CALL att_clean(tf_att)
       
       ! array size
@@ -869,21 +969,24 @@
       &  " attribute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i4%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i4%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i4%i_type=NF90_INT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i4%d_value) )THEN
-         DEALLOCATE(att__init_i4%d_value)
-      ENDIF
-      ALLOCATE(att__init_i4%d_value(il_len))
-
-      att__init_i4%d_value(:)=REAL(id_value(:),dp)
-      att__init_i4%i_len=il_len
+         tf_att%i_type=NF90_INT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=REAL(id_value(:),dp)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_i4
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i4_0d(cd_name, id_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -900,6 +1003,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i4_0d( cd_name, id_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -907,4 +1011,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       !local value
       CHARACTER(LEN=lc) :: cl_value
@@ -912,5 +1019,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i4_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(id_value))//"/)"
@@ -920,21 +1027,24 @@
       &  " attibute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i4_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i4_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i4_0d%i_type=NF90_INT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i4_0d%d_value) )THEN
-         DEALLOCATE(att__init_i4_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_i4_0d%d_value(1))
-
-      att__init_i4_0d%d_value(1)=REAL(id_value,dp)
-      att__init_i4_0d%i_len=1
+         tf_att%i_type=NF90_INT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=REAL(id_value,dp)
+      tf_att%i_len=1
 
    END FUNCTION att__init_i4_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i8(cd_name, kd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with array 
@@ -951,6 +1061,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i8( cd_name, kd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*),               INTENT(IN) :: cd_name
@@ -958,4 +1069,7 @@
       INTEGER(i4)                   , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                                 :: tf_att
+
       ! local value
       INTEGER(i4)       :: il_len
@@ -967,5 +1081,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i8)
+      CALL att_clean(tf_att)
       
       ! array size
@@ -982,21 +1096,24 @@
       &  " attibute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i8%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i8%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i8%i_type=NF90_INT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i8%d_value) )THEN
-         DEALLOCATE(att__init_i8%d_value)
-      ENDIF
-      ALLOCATE(att__init_i8%d_value(il_len))
-
-      att__init_i8%d_value(:)=REAL(kd_value(:),dp)
-      att__init_i8%i_len=il_len
+         tf_att%i_type=NF90_INT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(il_len))
+
+      tf_att%d_value(:)=REAL(kd_value(:),dp)
+      tf_att%i_len=il_len
 
    END FUNCTION att__init_i8
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att__init_i8_0d(cd_name, kd_value, id_type) &
+         & RESULT (tf_att)
    !-------------------------------------------------------------------
    !> @brief This function initialize an attribute structure with 
@@ -1013,6 +1130,7 @@
    !> @return attribute structure
    !-------------------------------------------------------------------
-   TYPE(TATT) FUNCTION att__init_i8_0d( cd_name, kd_value, id_type )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_name
@@ -1020,4 +1138,7 @@
       INTEGER(i4)     , INTENT(IN), OPTIONAL :: id_type
 
+      ! function
+      TYPE(TATT)                   :: tf_att
+
       ! local value
       CHARACTER(LEN=lc) :: cl_value
@@ -1025,5 +1146,5 @@
 
       ! clean attribute
-      CALL att_clean(att__init_i8_0d)
+      CALL att_clean(tf_att)
       
       cl_value="(/"//TRIM(fct_str(kd_value))//"/)"
@@ -1033,21 +1154,23 @@
       &  " attibute value "//TRIM(ADJUSTL(cl_value)) )      
 
-      att__init_i8_0d%c_name=TRIM(ADJUSTL(cd_name))
+      tf_att%c_name=TRIM(ADJUSTL(cd_name))
 
       IF( PRESENT(id_type) )THEN
-         att__init_i8_0d%i_type=id_type
+         tf_att%i_type=id_type
       ELSE
-         att__init_i8_0d%i_type=NF90_INT
-      ENDIF
-
-      IF( ASSOCIATED(att__init_i8_0d%d_value) )THEN
-         DEALLOCATE(att__init_i8_0d%d_value)
-      ENDIF
-      ALLOCATE(att__init_i8_0d%d_value(1))
-
-      att__init_i8_0d%d_value(1)=REAL(kd_value,dp)
-      att__init_i8_0d%i_len=1
+         tf_att%i_type=NF90_INT
+      ENDIF
+
+      IF( ASSOCIATED(tf_att%d_value) )THEN
+         DEALLOCATE(tf_att%d_value)
+      ENDIF
+      ALLOCATE(tf_att%d_value(1))
+
+      tf_att%d_value(1)=REAL(kd_value,dp)
+      tf_att%i_len=1
 
    END FUNCTION att__init_i8_0d
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   SUBROUTINE att__print_arr(td_att)
    !-------------------------------------------------------------------
    !> @brief This subroutine print informations of an array of attribute. 
@@ -1058,5 +1181,5 @@
    !> @param[in] td_att array of attribute structure
    !-------------------------------------------------------------------
-   SUBROUTINE att__print_arr(td_att)
+
       IMPLICIT NONE
 
@@ -1073,4 +1196,6 @@
 
    END SUBROUTINE att__print_arr
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   SUBROUTINE att__print_unit(td_att)
    !-------------------------------------------------------------------
    !> @brief This subroutine print attribute information.
@@ -1083,5 +1208,5 @@
    !> @param[in] td_att attribute structure
    !-------------------------------------------------------------------
-   SUBROUTINE att__print_unit(td_att)
+
       IMPLICIT NONE
 
@@ -1205,4 +1330,6 @@
 
    END SUBROUTINE att__print_unit
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   SUBROUTINE att__clean_unit(td_att)
    !-------------------------------------------------------------------
    !> @brief 
@@ -1211,9 +1338,12 @@
    !> @author J.Paul
    !> @date November, 2013 - Initial Version
-   !
+   !> @date January, 2019 
+   !> - nullify array inside attribute structure
+   !>
    !> @param[inout] td_att attribute strcuture
    !-------------------------------------------------------------------
-   SUBROUTINE att__clean_unit( td_att )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       TYPE(TATT),  INTENT(INOUT) :: td_att
@@ -1229,4 +1359,5 @@
          ! clean value
          DEALLOCATE(td_att%d_value)
+         NULLIFY(td_att%d_value)
       ENDIF
 
@@ -1235,4 +1366,6 @@
 
    END SUBROUTINE att__clean_unit
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   SUBROUTINE att__clean_arr(td_att)
    !-------------------------------------------------------------------
    !> @brief 
@@ -1244,6 +1377,7 @@
    !> @param[inout] td_att attribute strcuture
    !-------------------------------------------------------------------
-   SUBROUTINE att__clean_arr( td_att )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       TYPE(TATT), DIMENSION(:), INTENT(INOUT) :: td_att
@@ -1259,4 +1393,6 @@
 
    END SUBROUTINE att__clean_arr
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   SUBROUTINE att_get_dummy(cd_dummy)
    !-------------------------------------------------------------------
    !> @brief This subroutine fill dummy attribute array
@@ -1266,9 +1402,12 @@
    !> @date Marsh, 2016
    !> - close file (bugfix)
-   !
+   !> @date May, 2019
+   !> - read number of dummy element 
+   !>
    !> @param[in] cd_dummy dummy configuration file
    !-------------------------------------------------------------------
-   SUBROUTINE att_get_dummy( cd_dummy )
-      IMPLICIT NONE
+
+      IMPLICIT NONE
+
       ! Argument
       CHARACTER(LEN=*), INTENT(IN) :: cd_dummy
@@ -1280,12 +1419,16 @@
       LOGICAL       :: ll_exist
 
-      ! loop indices
       ! namelist
+      INTEGER(i4)                                :: in_ndumvar
+      INTEGER(i4)                                :: in_ndumdim
+      INTEGER(i4)                                :: in_ndumatt
       CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumvar
       CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumdim
       CHARACTER(LEN=lc), DIMENSION(ip_maxdumcfg) :: cn_dumatt
-
       !----------------------------------------------------------------
       NAMELIST /namdum/ &   !< dummy namelist
+      &  in_ndumvar,&       !< number of dummy elt in variable array
+      &  in_ndumdim,&       !< number of dummy elt in dimension array
+      &  in_ndumatt,&       !< number of dummy elt in attribute array
       &  cn_dumvar, &       !< variable  name
       &  cn_dumdim, &       !< dimension name
@@ -1314,11 +1457,21 @@
    
          READ( il_fileid, NML = namdum )
-         cm_dumatt(:)=cn_dumatt(:)
+         im_ndumatt  = in_ndumatt
+         cm_dumatt(:)= cn_dumatt(:)
 
          CLOSE( il_fileid )
+
+         IF( im_ndumatt > ip_maxdumcfg )THEN
+            CALL logger_fatal("ATT GET dUMMY : too much dummy attributes &
+            &     ( >"//fct_str(ip_maxdumcfg)//" ). &
+            &     set ip_maxdumcfg to higher value.")
+         ENDIF
 
       ENDIF
    
    END SUBROUTINE att_get_dummy
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+   FUNCTION att_is_dummy(td_att) &
+         & RESULT (lf_dummy)
    !-------------------------------------------------------------------
    !> @brief This function check if attribute is defined as dummy attribute
@@ -1327,9 +1480,11 @@
    !> @author J.Paul
    !> @date September, 2015 - Initial Version
-   !
+   !> @date, May, 2019
+   !> - use number of dummy elt in do-loop
+   !>
    !> @param[in] td_att attribute structure
    !> @return true if attribute is dummy attribute
    !-------------------------------------------------------------------
-   FUNCTION att_is_dummy(td_att)
+
       IMPLICIT NONE
 
@@ -1338,5 +1493,5 @@
       
       ! function
-      LOGICAL :: att_is_dummy
+      LOGICAL                :: lf_dummy
       
       ! loop indices
@@ -1344,13 +1499,18 @@
       !----------------------------------------------------------------
 
-      att_is_dummy=.FALSE.
-      DO ji=1,ip_maxdumcfg
+      CALL logger_trace("ATT IS DUMMY : check if attribute is useless")
+
+      lf_dummy=.FALSE.
+      DO ji=1,im_ndumatt
          IF( fct_lower(td_att%c_name) == fct_lower(cm_dumatt(ji)) )THEN
-            att_is_dummy=.TRUE.
+            lf_dummy=.TRUE.
             EXIT
          ENDIF
       ENDDO
 
+      CALL logger_trace("ATT IS DUMMY : check ok")
+
    END FUNCTION att_is_dummy
+   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 END MODULE att
 
