Index: /XIOS/trunk/src/config/var_attribute.conf
===================================================================
--- /XIOS/trunk/src/config/var_attribute.conf	(revision 1040)
+++ /XIOS/trunk/src/config/var_attribute.conf	(revision 1041)
@@ -1,2 +1,3 @@
 DECLARE_TYPE(type)
 DECLARE_ATTRIBUTE(StdString, name)
+DECLARE_ENUM4(ts_target, file, field, both, none)
Index: /XIOS/trunk/src/interface/c_attr/icvariable_attr.cpp
===================================================================
--- /XIOS/trunk/src/interface/c_attr/icvariable_attr.cpp	(revision 1040)
+++ /XIOS/trunk/src/interface/c_attr/icvariable_attr.cpp	(revision 1041)
@@ -44,4 +44,30 @@
 
 
+  void cxios_set_variable_ts_target(variable_Ptr variable_hdl, const char * ts_target, int ts_target_size)
+  {
+    std::string ts_target_str;
+    if (!cstr2string(ts_target, ts_target_size, ts_target_str)) return;
+    CTimer::get("XIOS").resume();
+    variable_hdl->ts_target.fromString(ts_target_str);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_variable_ts_target(variable_Ptr variable_hdl, char * ts_target, int ts_target_size)
+  {
+    CTimer::get("XIOS").resume();
+    if (!string_copy(variable_hdl->ts_target.getInheritedStringValue(), ts_target, ts_target_size))
+      ERROR("void cxios_get_variable_ts_target(variable_Ptr variable_hdl, char * ts_target, int ts_target_size)", << "Input string is too short");
+    CTimer::get("XIOS").suspend();
+  }
+
+  bool cxios_is_defined_variable_ts_target(variable_Ptr variable_hdl)
+  {
+     CTimer::get("XIOS").resume();
+     bool isDefined = variable_hdl->ts_target.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+     return isDefined;
+  }
+
+
   void cxios_set_variable_type(variable_Ptr variable_hdl, const char * type, int type_size)
   {
Index: /XIOS/trunk/src/interface/c_attr/icvariablegroup_attr.cpp
===================================================================
--- /XIOS/trunk/src/interface/c_attr/icvariablegroup_attr.cpp	(revision 1040)
+++ /XIOS/trunk/src/interface/c_attr/icvariablegroup_attr.cpp	(revision 1041)
@@ -70,4 +70,30 @@
 
 
+  void cxios_set_variablegroup_ts_target(variablegroup_Ptr variablegroup_hdl, const char * ts_target, int ts_target_size)
+  {
+    std::string ts_target_str;
+    if (!cstr2string(ts_target, ts_target_size, ts_target_str)) return;
+    CTimer::get("XIOS").resume();
+    variablegroup_hdl->ts_target.fromString(ts_target_str);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_variablegroup_ts_target(variablegroup_Ptr variablegroup_hdl, char * ts_target, int ts_target_size)
+  {
+    CTimer::get("XIOS").resume();
+    if (!string_copy(variablegroup_hdl->ts_target.getInheritedStringValue(), ts_target, ts_target_size))
+      ERROR("void cxios_get_variablegroup_ts_target(variablegroup_Ptr variablegroup_hdl, char * ts_target, int ts_target_size)", << "Input string is too short");
+    CTimer::get("XIOS").suspend();
+  }
+
+  bool cxios_is_defined_variablegroup_ts_target(variablegroup_Ptr variablegroup_hdl)
+  {
+     CTimer::get("XIOS").resume();
+     bool isDefined = variablegroup_hdl->ts_target.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+     return isDefined;
+  }
+
+
   void cxios_set_variablegroup_type(variablegroup_Ptr variablegroup_hdl, const char * type, int type_size)
   {
Index: /XIOS/trunk/src/interface/fortran_attr/ivariable_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/ivariable_attr.F90	(revision 1040)
+++ /XIOS/trunk/src/interface/fortran_attr/ivariable_attr.F90	(revision 1041)
@@ -12,5 +12,5 @@
 
   SUBROUTINE xios(set_variable_attr)  &
-    ( variable_id, name, type )
+    ( variable_id, name, ts_target, type )
 
     IMPLICIT NONE
@@ -18,4 +18,5 @@
       CHARACTER(LEN=*), INTENT(IN) ::variable_id
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
 
@@ -23,27 +24,29 @@
       (variable_id,variable_hdl)
       CALL xios(set_variable_attr_hdl_)   &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(set_variable_attr)
 
   SUBROUTINE xios(set_variable_attr_hdl)  &
-    ( variable_hdl, name, type )
+    ( variable_hdl, name, ts_target, type )
 
     IMPLICIT NONE
       TYPE(txios(variable)) , INTENT(IN) :: variable_hdl
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
 
       CALL xios(set_variable_attr_hdl_)  &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(set_variable_attr_hdl)
 
   SUBROUTINE xios(set_variable_attr_hdl_)   &
-    ( variable_hdl, name_, type_ )
+    ( variable_hdl, name_, ts_target_, type_ )
 
     IMPLICIT NONE
       TYPE(txios(variable)) , INTENT(IN) :: variable_hdl
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_
 
@@ -51,4 +54,9 @@
         CALL cxios_set_variable_name &
       (variable_hdl%daddr, name_, len(name_))
+      ENDIF
+
+      IF (PRESENT(ts_target_)) THEN
+        CALL cxios_set_variable_ts_target &
+      (variable_hdl%daddr, ts_target_, len(ts_target_))
       ENDIF
 
@@ -61,5 +69,5 @@
 
   SUBROUTINE xios(get_variable_attr)  &
-    ( variable_id, name, type )
+    ( variable_id, name, ts_target, type )
 
     IMPLICIT NONE
@@ -67,4 +75,5 @@
       CHARACTER(LEN=*), INTENT(IN) ::variable_id
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
 
@@ -72,27 +81,29 @@
       (variable_id,variable_hdl)
       CALL xios(get_variable_attr_hdl_)   &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(get_variable_attr)
 
   SUBROUTINE xios(get_variable_attr_hdl)  &
-    ( variable_hdl, name, type )
+    ( variable_hdl, name, ts_target, type )
 
     IMPLICIT NONE
       TYPE(txios(variable)) , INTENT(IN) :: variable_hdl
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
 
       CALL xios(get_variable_attr_hdl_)  &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(get_variable_attr_hdl)
 
   SUBROUTINE xios(get_variable_attr_hdl_)   &
-    ( variable_hdl, name_, type_ )
+    ( variable_hdl, name_, ts_target_, type_ )
 
     IMPLICIT NONE
       TYPE(txios(variable)) , INTENT(IN) :: variable_hdl
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_
 
@@ -100,4 +111,9 @@
         CALL cxios_get_variable_name &
       (variable_hdl%daddr, name_, len(name_))
+      ENDIF
+
+      IF (PRESENT(ts_target_)) THEN
+        CALL cxios_get_variable_ts_target &
+      (variable_hdl%daddr, ts_target_, len(ts_target_))
       ENDIF
 
@@ -110,5 +126,5 @@
 
   SUBROUTINE xios(is_defined_variable_attr)  &
-    ( variable_id, name, type )
+    ( variable_id, name, ts_target, type )
 
     IMPLICIT NONE
@@ -117,4 +133,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name
       LOGICAL(KIND=C_BOOL) :: name_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target
+      LOGICAL(KIND=C_BOOL) :: ts_target_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type
       LOGICAL(KIND=C_BOOL) :: type_tmp
@@ -123,10 +141,10 @@
       (variable_id,variable_hdl)
       CALL xios(is_defined_variable_attr_hdl_)   &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(is_defined_variable_attr)
 
   SUBROUTINE xios(is_defined_variable_attr_hdl)  &
-    ( variable_hdl, name, type )
+    ( variable_hdl, name, ts_target, type )
 
     IMPLICIT NONE
@@ -134,14 +152,16 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name
       LOGICAL(KIND=C_BOOL) :: name_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target
+      LOGICAL(KIND=C_BOOL) :: ts_target_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type
       LOGICAL(KIND=C_BOOL) :: type_tmp
 
       CALL xios(is_defined_variable_attr_hdl_)  &
-      ( variable_hdl, name, type )
+      ( variable_hdl, name, ts_target, type )
 
   END SUBROUTINE xios(is_defined_variable_attr_hdl)
 
   SUBROUTINE xios(is_defined_variable_attr_hdl_)   &
-    ( variable_hdl, name_, type_ )
+    ( variable_hdl, name_, ts_target_, type_ )
 
     IMPLICIT NONE
@@ -149,4 +169,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name_
       LOGICAL(KIND=C_BOOL) :: name__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target_
+      LOGICAL(KIND=C_BOOL) :: ts_target__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type_
       LOGICAL(KIND=C_BOOL) :: type__tmp
@@ -156,4 +178,10 @@
       (variable_hdl%daddr)
         name_ = name__tmp
+      ENDIF
+
+      IF (PRESENT(ts_target_)) THEN
+        ts_target__tmp = cxios_is_defined_variable_ts_target &
+      (variable_hdl%daddr)
+        ts_target_ = ts_target__tmp
       ENDIF
 
Index: /XIOS/trunk/src/interface/fortran_attr/ivariablegroup_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/ivariablegroup_attr.F90	(revision 1040)
+++ /XIOS/trunk/src/interface/fortran_attr/ivariablegroup_attr.F90	(revision 1041)
@@ -12,5 +12,5 @@
 
   SUBROUTINE xios(set_variablegroup_attr)  &
-    ( variablegroup_id, group_ref, name, type )
+    ( variablegroup_id, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -19,4 +19,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
 
@@ -24,10 +25,10 @@
       (variablegroup_id,variablegroup_hdl)
       CALL xios(set_variablegroup_attr_hdl_)   &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(set_variablegroup_attr)
 
   SUBROUTINE xios(set_variablegroup_attr_hdl)  &
-    ( variablegroup_hdl, group_ref, name, type )
+    ( variablegroup_hdl, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -35,13 +36,14 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
 
       CALL xios(set_variablegroup_attr_hdl_)  &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(set_variablegroup_attr_hdl)
 
   SUBROUTINE xios(set_variablegroup_attr_hdl_)   &
-    ( variablegroup_hdl, group_ref_, name_, type_ )
+    ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ )
 
     IMPLICIT NONE
@@ -49,4 +51,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: group_ref_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: name_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: ts_target_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_
 
@@ -61,4 +64,9 @@
       ENDIF
 
+      IF (PRESENT(ts_target_)) THEN
+        CALL cxios_set_variablegroup_ts_target &
+      (variablegroup_hdl%daddr, ts_target_, len(ts_target_))
+      ENDIF
+
       IF (PRESENT(type_)) THEN
         CALL cxios_set_variablegroup_type &
@@ -69,5 +77,5 @@
 
   SUBROUTINE xios(get_variablegroup_attr)  &
-    ( variablegroup_id, group_ref, name, type )
+    ( variablegroup_id, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -76,4 +84,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
 
@@ -81,10 +90,10 @@
       (variablegroup_id,variablegroup_hdl)
       CALL xios(get_variablegroup_attr_hdl_)   &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(get_variablegroup_attr)
 
   SUBROUTINE xios(get_variablegroup_attr_hdl)  &
-    ( variablegroup_hdl, group_ref, name, type )
+    ( variablegroup_hdl, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -92,13 +101,14 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
 
       CALL xios(get_variablegroup_attr_hdl_)  &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(get_variablegroup_attr_hdl)
 
   SUBROUTINE xios(get_variablegroup_attr_hdl_)   &
-    ( variablegroup_hdl, group_ref_, name_, type_ )
+    ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ )
 
     IMPLICIT NONE
@@ -106,4 +116,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: group_ref_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: name_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: ts_target_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_
 
@@ -118,4 +129,9 @@
       ENDIF
 
+      IF (PRESENT(ts_target_)) THEN
+        CALL cxios_get_variablegroup_ts_target &
+      (variablegroup_hdl%daddr, ts_target_, len(ts_target_))
+      ENDIF
+
       IF (PRESENT(type_)) THEN
         CALL cxios_get_variablegroup_type &
@@ -126,5 +142,5 @@
 
   SUBROUTINE xios(is_defined_variablegroup_attr)  &
-    ( variablegroup_id, group_ref, name, type )
+    ( variablegroup_id, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -135,4 +151,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name
       LOGICAL(KIND=C_BOOL) :: name_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target
+      LOGICAL(KIND=C_BOOL) :: ts_target_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type
       LOGICAL(KIND=C_BOOL) :: type_tmp
@@ -141,10 +159,10 @@
       (variablegroup_id,variablegroup_hdl)
       CALL xios(is_defined_variablegroup_attr_hdl_)   &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(is_defined_variablegroup_attr)
 
   SUBROUTINE xios(is_defined_variablegroup_attr_hdl)  &
-    ( variablegroup_hdl, group_ref, name, type )
+    ( variablegroup_hdl, group_ref, name, ts_target, type )
 
     IMPLICIT NONE
@@ -154,14 +172,16 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name
       LOGICAL(KIND=C_BOOL) :: name_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target
+      LOGICAL(KIND=C_BOOL) :: ts_target_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type
       LOGICAL(KIND=C_BOOL) :: type_tmp
 
       CALL xios(is_defined_variablegroup_attr_hdl_)  &
-      ( variablegroup_hdl, group_ref, name, type )
+      ( variablegroup_hdl, group_ref, name, ts_target, type )
 
   END SUBROUTINE xios(is_defined_variablegroup_attr_hdl)
 
   SUBROUTINE xios(is_defined_variablegroup_attr_hdl_)   &
-    ( variablegroup_hdl, group_ref_, name_, type_ )
+    ( variablegroup_hdl, group_ref_, name_, ts_target_, type_ )
 
     IMPLICIT NONE
@@ -171,4 +191,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: name_
       LOGICAL(KIND=C_BOOL) :: name__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: ts_target_
+      LOGICAL(KIND=C_BOOL) :: ts_target__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: type_
       LOGICAL(KIND=C_BOOL) :: type__tmp
@@ -186,4 +208,10 @@
       ENDIF
 
+      IF (PRESENT(ts_target_)) THEN
+        ts_target__tmp = cxios_is_defined_variablegroup_ts_target &
+      (variablegroup_hdl%daddr)
+        ts_target_ = ts_target__tmp
+      ENDIF
+
       IF (PRESENT(type_)) THEN
         type__tmp = cxios_is_defined_variablegroup_type &
Index: /XIOS/trunk/src/interface/fortran_attr/variable_interface_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/variable_interface_attr.F90	(revision 1040)
+++ /XIOS/trunk/src/interface/fortran_attr/variable_interface_attr.F90	(revision 1041)
@@ -31,4 +31,25 @@
 
 
+    SUBROUTINE cxios_set_variable_ts_target(variable_hdl, ts_target, ts_target_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: ts_target
+      INTEGER  (kind = C_INT)     , VALUE        :: ts_target_size
+    END SUBROUTINE cxios_set_variable_ts_target
+
+    SUBROUTINE cxios_get_variable_ts_target(variable_hdl, ts_target, ts_target_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: ts_target
+      INTEGER  (kind = C_INT)     , VALUE        :: ts_target_size
+    END SUBROUTINE cxios_get_variable_ts_target
+
+    FUNCTION cxios_is_defined_variable_ts_target(variable_hdl) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_variable_ts_target
+      INTEGER (kind = C_INTPTR_T), VALUE :: variable_hdl
+    END FUNCTION cxios_is_defined_variable_ts_target
+
+
     SUBROUTINE cxios_set_variable_type(variable_hdl, type, type_size) BIND(C)
       USE ISO_C_BINDING
Index: /XIOS/trunk/src/interface/fortran_attr/variablegroup_interface_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/variablegroup_interface_attr.F90	(revision 1040)
+++ /XIOS/trunk/src/interface/fortran_attr/variablegroup_interface_attr.F90	(revision 1041)
@@ -52,4 +52,25 @@
 
 
+    SUBROUTINE cxios_set_variablegroup_ts_target(variablegroup_hdl, ts_target, ts_target_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: ts_target
+      INTEGER  (kind = C_INT)     , VALUE        :: ts_target_size
+    END SUBROUTINE cxios_set_variablegroup_ts_target
+
+    SUBROUTINE cxios_get_variablegroup_ts_target(variablegroup_hdl, ts_target, ts_target_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: ts_target
+      INTEGER  (kind = C_INT)     , VALUE        :: ts_target_size
+    END SUBROUTINE cxios_get_variablegroup_ts_target
+
+    FUNCTION cxios_is_defined_variablegroup_ts_target(variablegroup_hdl) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_variablegroup_ts_target
+      INTEGER (kind = C_INTPTR_T), VALUE :: variablegroup_hdl
+    END FUNCTION cxios_is_defined_variablegroup_ts_target
+
+
     SUBROUTINE cxios_set_variablegroup_type(variablegroup_hdl, type, type_size) BIND(C)
       USE ISO_C_BINDING
Index: /XIOS/trunk/src/node/context.cpp
===================================================================
--- /XIOS/trunk/src/node/context.cpp	(revision 1040)
+++ /XIOS/trunk/src/node/context.cpp	(revision 1041)
@@ -1002,4 +1002,18 @@
        CFile* file = allFiles[i];
 
+       std::vector<CVariable*> fileVars, fieldVars, vars = file->getAllVariables();
+       for (size_t k = 0; k < vars.size(); k++)
+       {
+         CVariable* var = vars[k];
+
+         if (var->ts_target.isEmpty()
+              || var->ts_target == CVariable::ts_target_attr::file || var->ts_target == CVariable::ts_target_attr::both)
+           fileVars.push_back(var);
+
+         if (!var->ts_target.isEmpty()
+              && (var->ts_target == CVariable::ts_target_attr::field || var->ts_target == CVariable::ts_target_attr::both))
+           fieldVars.push_back(var);
+       }
+
        if (!file->timeseries.isEmpty() && file->timeseries != CFile::timeseries_attr::none)
        {
@@ -1015,5 +1029,8 @@
              CFile* tsFile = CFile::create();
              tsFile->duplicateAttributes(file);
-             tsFile->setVirtualVariableGroup(file->getVirtualVariableGroup());
+
+             // Add variables originating from file and targeted to timeserie file
+             for (size_t k = 0; k < fileVars.size(); k++)
+               tsFile->getVirtualVariableGroup()->addChild(fileVars[k]);
 
              tsFile->name = tsPrefix + "_";
@@ -1030,5 +1047,24 @@
              CField* tsField = tsFile->addField();
              tsField->field_ref = field->getId();
-             tsField->setVirtualVariableGroup(field->getVirtualVariableGroup());
+
+             // Add variables originating from file and targeted to timeserie field
+             for (size_t k = 0; k < fieldVars.size(); k++)
+               tsField->getVirtualVariableGroup()->addChild(fieldVars[k]);
+
+             vars = field->getAllVariables();
+             for (size_t k = 0; k < vars.size(); k++)
+             {
+               CVariable* var = vars[k];
+
+               // Add variables originating from field and targeted to timeserie field
+               if (var->ts_target.isEmpty()
+                    || var->ts_target == CVariable::ts_target_attr::field || var->ts_target == CVariable::ts_target_attr::both)
+                 tsField->getVirtualVariableGroup()->addChild(var);
+
+               // Add variables originating from field and targeted to timeserie file
+               if (!var->ts_target.isEmpty()
+                    && (var->ts_target == CVariable::ts_target_attr::file || var->ts_target == CVariable::ts_target_attr::both))
+                 tsFile->getVirtualVariableGroup()->addChild(var);
+             }
 
              tsFile->solveFieldRefInheritance(true);
Index: /XIOS/trunk/src/node/variable.hpp
===================================================================
--- /XIOS/trunk/src/node/variable.hpp	(revision 1040)
+++ /XIOS/trunk/src/node/variable.hpp	(revision 1041)
@@ -9,4 +9,5 @@
 #include "attribute_enum.hpp"
 #include "attribute_enum_impl.hpp"
+#include "declare_attribute.hpp"
 
 namespace xios
