Index: /XIOS/trunk/src/array_new.hpp
===================================================================
--- /XIOS/trunk/src/array_new.hpp	(revision 463)
+++ /XIOS/trunk/src/array_new.hpp	(revision 464)
@@ -7,9 +7,10 @@
 #include "buffer_out.hpp"
 #include "message.hpp"
+#include <cmath>
 
 using namespace blitz ;
+BZ_DECLARE_FUNCTION(round)
 namespace xios
 {
-
     
 template <typename T_numtype,int N_rank>
Index: /XIOS/trunk/src/config/field_attribute.conf
===================================================================
--- /XIOS/trunk/src/config/field_attribute.conf	(revision 463)
+++ /XIOS/trunk/src/config/field_attribute.conf	(revision 464)
@@ -21,2 +21,4 @@
 DECLARE_ATTRIBUTE(double,    valid_min)
 DECLARE_ATTRIBUTE(double,    valid_max)
+DECLARE_ATTRIBUTE(double,    add_offset)
+DECLARE_ATTRIBUTE(double,    scale_factor)
Index: /XIOS/trunk/src/interface/c_attr/icfield_attr.cpp
===================================================================
--- /XIOS/trunk/src/interface/c_attr/icfield_attr.cpp	(revision 463)
+++ /XIOS/trunk/src/interface/c_attr/icfield_attr.cpp	(revision 464)
@@ -17,4 +17,26 @@
   typedef xios::CField*  field_Ptr;
   
+  void cxios_set_field_add_offset(field_Ptr field_hdl, double add_offset)
+  {
+     CTimer::get("XIOS").resume();
+    field_hdl->add_offset.setValue(add_offset);
+    field_hdl->sendAttributToServer(field_hdl->add_offset);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_field_add_offset(field_Ptr field_hdl, double* add_offset)
+  {
+    *add_offset = field_hdl->add_offset.getInheritedValue();
+  }
+  
+  bool cxios_is_defined_field_add_offset(field_Ptr field_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return field_hdl->add_offset.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
   void cxios_set_field_axis_ref(field_Ptr field_hdl, const char * axis_ref, int axis_ref_size)
   {
@@ -348,4 +370,26 @@
   
   
+  void cxios_set_field_scale_factor(field_Ptr field_hdl, double scale_factor)
+  {
+     CTimer::get("XIOS").resume();
+    field_hdl->scale_factor.setValue(scale_factor);
+    field_hdl->sendAttributToServer(field_hdl->scale_factor);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_field_scale_factor(field_Ptr field_hdl, double* scale_factor)
+  {
+    *scale_factor = field_hdl->scale_factor.getInheritedValue();
+  }
+  
+  bool cxios_is_defined_field_scale_factor(field_Ptr field_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return field_hdl->scale_factor.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
   void cxios_set_field_standard_name(field_Ptr field_hdl, const char * standard_name, int standard_name_size)
   {
Index: /XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp
===================================================================
--- /XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp	(revision 463)
+++ /XIOS/trunk/src/interface/c_attr/icfieldgroup_attr.cpp	(revision 464)
@@ -17,4 +17,26 @@
   typedef xios::CFieldGroup*  fieldgroup_Ptr;
   
+  void cxios_set_fieldgroup_add_offset(fieldgroup_Ptr fieldgroup_hdl, double add_offset)
+  {
+     CTimer::get("XIOS").resume();
+    fieldgroup_hdl->add_offset.setValue(add_offset);
+    fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->add_offset);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_fieldgroup_add_offset(fieldgroup_Ptr fieldgroup_hdl, double* add_offset)
+  {
+    *add_offset = fieldgroup_hdl->add_offset.getInheritedValue();
+  }
+  
+  bool cxios_is_defined_fieldgroup_add_offset(fieldgroup_Ptr fieldgroup_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return fieldgroup_hdl->add_offset.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
   void cxios_set_fieldgroup_axis_ref(fieldgroup_Ptr fieldgroup_hdl, const char * axis_ref, int axis_ref_size)
   {
@@ -375,4 +397,26 @@
   
   
+  void cxios_set_fieldgroup_scale_factor(fieldgroup_Ptr fieldgroup_hdl, double scale_factor)
+  {
+     CTimer::get("XIOS").resume();
+    fieldgroup_hdl->scale_factor.setValue(scale_factor);
+    fieldgroup_hdl->sendAttributToServer(fieldgroup_hdl->scale_factor);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_fieldgroup_scale_factor(fieldgroup_Ptr fieldgroup_hdl, double* scale_factor)
+  {
+    *scale_factor = fieldgroup_hdl->scale_factor.getInheritedValue();
+  }
+  
+  bool cxios_is_defined_fieldgroup_scale_factor(fieldgroup_Ptr fieldgroup_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return fieldgroup_hdl->scale_factor.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
   void cxios_set_fieldgroup_standard_name(fieldgroup_Ptr fieldgroup_hdl, const char * standard_name, int standard_name_size)
   {
Index: /XIOS/trunk/src/interface/fortran_attr/field_interface_attr.f90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/field_interface_attr.f90	(revision 463)
+++ /XIOS/trunk/src/interface/fortran_attr/field_interface_attr.f90	(revision 464)
@@ -9,4 +9,23 @@
     
     
+    SUBROUTINE cxios_set_field_add_offset(field_hdl, add_offset) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+      REAL (KIND=C_DOUBLE)      , VALUE :: add_offset
+    END SUBROUTINE cxios_set_field_add_offset
+    
+    SUBROUTINE cxios_get_field_add_offset(field_hdl, add_offset) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+      REAL (KIND=C_DOUBLE)             :: add_offset
+    END SUBROUTINE cxios_get_field_add_offset
+    
+    FUNCTION cxios_is_defined_field_add_offset(field_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_add_offset
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+    END FUNCTION cxios_is_defined_field_add_offset
+    
+    
     SUBROUTINE cxios_set_field_axis_ref(field_hdl, axis_ref, axis_ref_size) BIND(C)
       USE ISO_C_BINDING
@@ -274,4 +293,23 @@
     
     
+    SUBROUTINE cxios_set_field_scale_factor(field_hdl, scale_factor) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+      REAL (KIND=C_DOUBLE)      , VALUE :: scale_factor
+    END SUBROUTINE cxios_set_field_scale_factor
+    
+    SUBROUTINE cxios_get_field_scale_factor(field_hdl, scale_factor) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+      REAL (KIND=C_DOUBLE)             :: scale_factor
+    END SUBROUTINE cxios_get_field_scale_factor
+    
+    FUNCTION cxios_is_defined_field_scale_factor(field_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_field_scale_factor
+      INTEGER (kind = C_INTPTR_T), VALUE :: field_hdl
+    END FUNCTION cxios_is_defined_field_scale_factor
+    
+    
     SUBROUTINE cxios_set_field_standard_name(field_hdl, standard_name, standard_name_size) BIND(C)
       USE ISO_C_BINDING
Index: /XIOS/trunk/src/interface/fortran_attr/fieldgroup_interface_attr.f90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/fieldgroup_interface_attr.f90	(revision 463)
+++ /XIOS/trunk/src/interface/fortran_attr/fieldgroup_interface_attr.f90	(revision 464)
@@ -9,4 +9,23 @@
     
     
+    SUBROUTINE cxios_set_fieldgroup_add_offset(fieldgroup_hdl, add_offset) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+      REAL (KIND=C_DOUBLE)      , VALUE :: add_offset
+    END SUBROUTINE cxios_set_fieldgroup_add_offset
+    
+    SUBROUTINE cxios_get_fieldgroup_add_offset(fieldgroup_hdl, add_offset) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+      REAL (KIND=C_DOUBLE)             :: add_offset
+    END SUBROUTINE cxios_get_fieldgroup_add_offset
+    
+    FUNCTION cxios_is_defined_fieldgroup_add_offset(fieldgroup_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_add_offset
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+    END FUNCTION cxios_is_defined_fieldgroup_add_offset
+    
+    
     SUBROUTINE cxios_set_fieldgroup_axis_ref(fieldgroup_hdl, axis_ref, axis_ref_size) BIND(C)
       USE ISO_C_BINDING
@@ -295,4 +314,23 @@
     
     
+    SUBROUTINE cxios_set_fieldgroup_scale_factor(fieldgroup_hdl, scale_factor) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+      REAL (KIND=C_DOUBLE)      , VALUE :: scale_factor
+    END SUBROUTINE cxios_set_fieldgroup_scale_factor
+    
+    SUBROUTINE cxios_get_fieldgroup_scale_factor(fieldgroup_hdl, scale_factor) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+      REAL (KIND=C_DOUBLE)             :: scale_factor
+    END SUBROUTINE cxios_get_fieldgroup_scale_factor
+    
+    FUNCTION cxios_is_defined_fieldgroup_scale_factor(fieldgroup_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_fieldgroup_scale_factor
+      INTEGER (kind = C_INTPTR_T), VALUE :: fieldgroup_hdl
+    END FUNCTION cxios_is_defined_fieldgroup_scale_factor
+    
+    
     SUBROUTINE cxios_set_fieldgroup_standard_name(fieldgroup_hdl, standard_name, standard_name_size) BIND(C)
       USE ISO_C_BINDING
Index: /XIOS/trunk/src/interface/fortran_attr/ifield_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/ifield_attr.F90	(revision 463)
+++ /XIOS/trunk/src/interface/fortran_attr/ifield_attr.F90	(revision 464)
@@ -12,10 +12,12 @@
   
   SUBROUTINE xios(set_field_attr)  &
-    ( field_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field))  :: field_hdl
       CHARACTER(LEN=*), INTENT(IN) ::field_id
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value
@@ -32,4 +34,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation
       INTEGER  , OPTIONAL, INTENT(IN) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit
@@ -39,15 +42,18 @@
       CALL xios(get_field_handle)(field_id,field_hdl)
       CALL xios(set_field_attr_hdl_)   &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(set_field_attr)
   
   SUBROUTINE xios(set_field_attr_hdl)  &
-    ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value
@@ -64,4 +70,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation
       INTEGER  , OPTIONAL, INTENT(IN) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit
@@ -70,16 +77,18 @@
       
       CALL xios(set_field_attr_hdl_)  &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(set_field_attr_hdl)
   
   SUBROUTINE xios(set_field_attr_hdl_)   &
-    ( field_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_  &
-    , grid_ref_, level_, long_name_, name_, operation_, prec_, standard_name_, unit_, valid_max_  &
-    , valid_min_ )
+    ( field_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
+    , freq_op_, grid_ref_, level_, long_name_, name_, operation_, prec_, scale_factor_, standard_name_  &
+    , unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_
@@ -96,4 +105,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation_
       INTEGER  , OPTIONAL, INTENT(IN) :: prec_
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_
@@ -101,4 +111,8 @@
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min_
       
+      IF (PRESENT(add_offset_)) THEN
+        CALL cxios_set_field_add_offset(field_hdl%daddr, add_offset_)
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         CALL cxios_set_field_axis_ref(field_hdl%daddr, axis_ref_, len(axis_ref_))
@@ -154,4 +168,8 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        CALL cxios_set_field_scale_factor(field_hdl%daddr, scale_factor_)
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         CALL cxios_set_field_standard_name(field_hdl%daddr, standard_name_, len(standard_name_))
@@ -175,10 +193,12 @@
   
   SUBROUTINE xios(get_field_attr)  &
-    ( field_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field))  :: field_hdl
       CHARACTER(LEN=*), INTENT(IN) ::field_id
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value
@@ -195,4 +215,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit
@@ -202,15 +223,18 @@
       CALL xios(get_field_handle)(field_id,field_hdl)
       CALL xios(get_field_attr_hdl_)   &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(get_field_attr)
   
   SUBROUTINE xios(get_field_attr_hdl)  &
-    ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value
@@ -227,4 +251,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit
@@ -233,16 +258,18 @@
       
       CALL xios(get_field_attr_hdl_)  &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(get_field_attr_hdl)
   
   SUBROUTINE xios(get_field_attr_hdl_)   &
-    ( field_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_  &
-    , grid_ref_, level_, long_name_, name_, operation_, prec_, standard_name_, unit_, valid_max_  &
-    , valid_min_ )
+    ( field_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
+    , freq_op_, grid_ref_, level_, long_name_, name_, operation_, prec_, scale_factor_, standard_name_  &
+    , unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_
@@ -259,4 +286,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation_
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec_
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_
@@ -264,4 +292,8 @@
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min_
       
+      IF (PRESENT(add_offset_)) THEN
+        CALL cxios_get_field_add_offset(field_hdl%daddr, add_offset_)
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         CALL cxios_get_field_axis_ref(field_hdl%daddr, axis_ref_, len(axis_ref_))
@@ -317,4 +349,8 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        CALL cxios_get_field_scale_factor(field_hdl%daddr, scale_factor_)
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         CALL cxios_get_field_standard_name(field_hdl%daddr, standard_name_, len(standard_name_))
@@ -338,10 +374,13 @@
   
   SUBROUTINE xios(is_defined_field_attr)  &
-    ( field_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field))  :: field_hdl
       CHARACTER(LEN=*), INTENT(IN) ::field_id
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset
+      LOGICAL(KIND=C_BOOL) :: add_offset_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref
       LOGICAL(KIND=C_BOOL) :: axis_ref_tmp
@@ -370,4 +409,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec
       LOGICAL(KIND=C_BOOL) :: prec_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor
+      LOGICAL(KIND=C_BOOL) :: scale_factor_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name
       LOGICAL(KIND=C_BOOL) :: standard_name_tmp
@@ -381,15 +422,19 @@
       CALL xios(get_field_handle)(field_id,field_hdl)
       CALL xios(is_defined_field_attr_hdl_)   &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(is_defined_field_attr)
   
   SUBROUTINE xios(is_defined_field_attr_hdl)  &
-    ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-    , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+    ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+    , valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset
+      LOGICAL(KIND=C_BOOL) :: add_offset_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref
       LOGICAL(KIND=C_BOOL) :: axis_ref_tmp
@@ -418,4 +463,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec
       LOGICAL(KIND=C_BOOL) :: prec_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor
+      LOGICAL(KIND=C_BOOL) :: scale_factor_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name
       LOGICAL(KIND=C_BOOL) :: standard_name_tmp
@@ -428,16 +475,19 @@
       
       CALL xios(is_defined_field_attr_hdl_)  &
-      ( field_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op, grid_ref  &
-      , level, long_name, name, operation, prec, standard_name, unit, valid_max, valid_min )
+      ( field_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, level, long_name, name, operation, prec, scale_factor, standard_name, unit  &
+      , valid_max, valid_min )
     
   END SUBROUTINE xios(is_defined_field_attr_hdl)
   
   SUBROUTINE xios(is_defined_field_attr_hdl_)   &
-    ( field_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_, freq_op_  &
-    , grid_ref_, level_, long_name_, name_, operation_, prec_, standard_name_, unit_, valid_max_  &
-    , valid_min_ )
+    ( field_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
+    , freq_op_, grid_ref_, level_, long_name_, name_, operation_, prec_, scale_factor_, standard_name_  &
+    , unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(field)) , INTENT(IN) :: field_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset_
+      LOGICAL(KIND=C_BOOL) :: add_offset__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_
       LOGICAL(KIND=C_BOOL) :: axis_ref__tmp
@@ -466,4 +516,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec_
       LOGICAL(KIND=C_BOOL) :: prec__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor_
+      LOGICAL(KIND=C_BOOL) :: scale_factor__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_
       LOGICAL(KIND=C_BOOL) :: standard_name__tmp
@@ -475,4 +527,9 @@
       LOGICAL(KIND=C_BOOL) :: valid_min__tmp
       
+      IF (PRESENT(add_offset_)) THEN
+        add_offset__tmp=cxios_is_defined_field_add_offset(field_hdl%daddr)
+        add_offset_=add_offset__tmp
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         axis_ref__tmp=cxios_is_defined_field_axis_ref(field_hdl%daddr)
@@ -540,4 +597,9 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        scale_factor__tmp=cxios_is_defined_field_scale_factor(field_hdl%daddr)
+        scale_factor_=scale_factor__tmp
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         standard_name__tmp=cxios_is_defined_field_standard_name(field_hdl%daddr)
Index: /XIOS/trunk/src/interface/fortran_attr/ifieldgroup_attr.F90
===================================================================
--- /XIOS/trunk/src/interface/fortran_attr/ifieldgroup_attr.F90	(revision 463)
+++ /XIOS/trunk/src/interface/fortran_attr/ifieldgroup_attr.F90	(revision 464)
@@ -12,11 +12,12 @@
   
   SUBROUTINE xios(set_fieldgroup_attr)  &
-    ( fieldgroup_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup))  :: fieldgroup_hdl
       CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value
@@ -34,4 +35,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation
       INTEGER  , OPTIONAL, INTENT(IN) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit
@@ -41,17 +43,18 @@
       CALL xios(get_fieldgroup_handle)(fieldgroup_id,fieldgroup_hdl)
       CALL xios(set_fieldgroup_attr_hdl_)   &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(set_fieldgroup_attr)
   
   SUBROUTINE xios(set_fieldgroup_attr_hdl)  &
-    ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value
@@ -69,4 +72,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation
       INTEGER  , OPTIONAL, INTENT(IN) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit
@@ -75,17 +79,18 @@
       
       CALL xios(set_fieldgroup_attr_hdl_)  &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(set_fieldgroup_attr_hdl)
   
   SUBROUTINE xios(set_fieldgroup_attr_hdl_)   &
-    ( fieldgroup_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
-    , freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_, standard_name_  &
-    , unit_, valid_max_, valid_min_ )
+    ( fieldgroup_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_  &
+    , freq_offset_, freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_  &
+    , scale_factor_, standard_name_, unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: add_offset_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: axis_ref_
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: default_value_
@@ -103,4 +108,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: operation_
       INTEGER  , OPTIONAL, INTENT(IN) :: prec_
+      REAL (KIND=8) , OPTIONAL, INTENT(IN) :: scale_factor_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: standard_name_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: unit_
@@ -108,4 +114,8 @@
       REAL (KIND=8) , OPTIONAL, INTENT(IN) :: valid_min_
       
+      IF (PRESENT(add_offset_)) THEN
+        CALL cxios_set_fieldgroup_add_offset(fieldgroup_hdl%daddr, add_offset_)
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         CALL cxios_set_fieldgroup_axis_ref(fieldgroup_hdl%daddr, axis_ref_, len(axis_ref_))
@@ -165,4 +175,8 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        CALL cxios_set_fieldgroup_scale_factor(fieldgroup_hdl%daddr, scale_factor_)
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         CALL cxios_set_fieldgroup_standard_name(fieldgroup_hdl%daddr, standard_name_, len(standard_name_))
@@ -186,11 +200,12 @@
   
   SUBROUTINE xios(get_fieldgroup_attr)  &
-    ( fieldgroup_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup))  :: fieldgroup_hdl
       CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value
@@ -208,4 +223,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit
@@ -215,17 +231,18 @@
       CALL xios(get_fieldgroup_handle)(fieldgroup_id,fieldgroup_hdl)
       CALL xios(get_fieldgroup_attr_hdl_)   &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(get_fieldgroup_attr)
   
   SUBROUTINE xios(get_fieldgroup_attr_hdl)  &
-    ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value
@@ -243,4 +260,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit
@@ -249,17 +267,18 @@
       
       CALL xios(get_fieldgroup_attr_hdl_)  &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(get_fieldgroup_attr_hdl)
   
   SUBROUTINE xios(get_fieldgroup_attr_hdl_)   &
-    ( fieldgroup_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
-    , freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_, standard_name_  &
-    , unit_, valid_max_, valid_min_ )
+    ( fieldgroup_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_  &
+    , freq_offset_, freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_  &
+    , scale_factor_, standard_name_, unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: add_offset_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: axis_ref_
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: default_value_
@@ -277,4 +296,5 @@
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: operation_
       INTEGER  , OPTIONAL, INTENT(OUT) :: prec_
+      REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: scale_factor_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: standard_name_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: unit_
@@ -282,4 +302,8 @@
       REAL (KIND=8) , OPTIONAL, INTENT(OUT) :: valid_min_
       
+      IF (PRESENT(add_offset_)) THEN
+        CALL cxios_get_fieldgroup_add_offset(fieldgroup_hdl%daddr, add_offset_)
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         CALL cxios_get_fieldgroup_axis_ref(fieldgroup_hdl%daddr, axis_ref_, len(axis_ref_))
@@ -339,4 +363,8 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        CALL cxios_get_fieldgroup_scale_factor(fieldgroup_hdl%daddr, scale_factor_)
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         CALL cxios_get_fieldgroup_standard_name(fieldgroup_hdl%daddr, standard_name_, len(standard_name_))
@@ -360,11 +388,13 @@
   
   SUBROUTINE xios(is_defined_fieldgroup_attr)  &
-    ( fieldgroup_id, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_id, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup))  :: fieldgroup_hdl
       CHARACTER(LEN=*), INTENT(IN) ::fieldgroup_id
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset
+      LOGICAL(KIND=C_BOOL) :: add_offset_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref
       LOGICAL(KIND=C_BOOL) :: axis_ref_tmp
@@ -395,4 +425,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec
       LOGICAL(KIND=C_BOOL) :: prec_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor
+      LOGICAL(KIND=C_BOOL) :: scale_factor_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name
       LOGICAL(KIND=C_BOOL) :: standard_name_tmp
@@ -406,17 +438,19 @@
       CALL xios(get_fieldgroup_handle)(fieldgroup_id,fieldgroup_hdl)
       CALL xios(is_defined_fieldgroup_attr_hdl_)   &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(is_defined_fieldgroup_attr)
   
   SUBROUTINE xios(is_defined_fieldgroup_attr_hdl)  &
-    ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-    , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-    , valid_min )
+    ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+    , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+    , unit, valid_max, valid_min )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset
+      LOGICAL(KIND=C_BOOL) :: add_offset_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref
       LOGICAL(KIND=C_BOOL) :: axis_ref_tmp
@@ -447,4 +481,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec
       LOGICAL(KIND=C_BOOL) :: prec_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor
+      LOGICAL(KIND=C_BOOL) :: scale_factor_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name
       LOGICAL(KIND=C_BOOL) :: standard_name_tmp
@@ -457,17 +493,19 @@
       
       CALL xios(is_defined_fieldgroup_attr_hdl_)  &
-      ( fieldgroup_hdl, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset, freq_op  &
-      , grid_ref, group_ref, level, long_name, name, operation, prec, standard_name, unit, valid_max  &
-      , valid_min )
+      ( fieldgroup_hdl, add_offset, axis_ref, default_value, domain_ref, enabled, field_ref, freq_offset  &
+      , freq_op, grid_ref, group_ref, level, long_name, name, operation, prec, scale_factor, standard_name  &
+      , unit, valid_max, valid_min )
     
   END SUBROUTINE xios(is_defined_fieldgroup_attr_hdl)
   
   SUBROUTINE xios(is_defined_fieldgroup_attr_hdl_)   &
-    ( fieldgroup_hdl, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_, freq_offset_  &
-    , freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_, standard_name_  &
-    , unit_, valid_max_, valid_min_ )
+    ( fieldgroup_hdl, add_offset_, axis_ref_, default_value_, domain_ref_, enabled_, field_ref_  &
+    , freq_offset_, freq_op_, grid_ref_, group_ref_, level_, long_name_, name_, operation_, prec_  &
+    , scale_factor_, standard_name_, unit_, valid_max_, valid_min_ )
     
     IMPLICIT NONE
       TYPE(txios(fieldgroup)) , INTENT(IN) :: fieldgroup_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: add_offset_
+      LOGICAL(KIND=C_BOOL) :: add_offset__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: axis_ref_
       LOGICAL(KIND=C_BOOL) :: axis_ref__tmp
@@ -498,4 +536,6 @@
       LOGICAL, OPTIONAL, INTENT(OUT) :: prec_
       LOGICAL(KIND=C_BOOL) :: prec__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: scale_factor_
+      LOGICAL(KIND=C_BOOL) :: scale_factor__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: standard_name_
       LOGICAL(KIND=C_BOOL) :: standard_name__tmp
@@ -507,4 +547,9 @@
       LOGICAL(KIND=C_BOOL) :: valid_min__tmp
       
+      IF (PRESENT(add_offset_)) THEN
+        add_offset__tmp=cxios_is_defined_fieldgroup_add_offset(fieldgroup_hdl%daddr)
+        add_offset_=add_offset__tmp
+      ENDIF
+      
       IF (PRESENT(axis_ref_)) THEN
         axis_ref__tmp=cxios_is_defined_fieldgroup_axis_ref(fieldgroup_hdl%daddr)
@@ -577,4 +622,9 @@
       ENDIF
       
+      IF (PRESENT(scale_factor_)) THEN
+        scale_factor__tmp=cxios_is_defined_fieldgroup_scale_factor(fieldgroup_hdl%daddr)
+        scale_factor_=scale_factor__tmp
+      ENDIF
+      
       IF (PRESENT(standard_name_)) THEN
         standard_name__tmp=cxios_is_defined_fieldgroup_standard_name(fieldgroup_hdl%daddr)
Index: /XIOS/trunk/src/node/field.cpp
===================================================================
--- /XIOS/trunk/src/node/field.cpp	(revision 463)
+++ /XIOS/trunk/src/node/field.cpp	(revision 464)
@@ -621,4 +621,10 @@
    }
    
+   void CField::scaleFactorAddOffset(double scaleFactor, double addOffset)
+   {
+     map<int, CArray<double,1>* >::iterator it;
+     for(it=data_srv.begin();it!=data_srv.end();it++) *it->second = (*it->second -addOffset) * 1./scaleFactor  ;
+   }
+   
    void CField::outputField(CArray<double,3>& fieldOut)
    {
Index: /XIOS/trunk/src/node/field.hpp
===================================================================
--- /XIOS/trunk/src/node/field.hpp	(revision 463)
+++ /XIOS/trunk/src/node/field.hpp	(revision 464)
@@ -135,4 +135,5 @@
         void outputField(CArray<double,3>& fieldOut) ;
         void outputField(CArray<double,2>& fieldOut) ;
+        void scaleFactorAddOffset(double scaleFactor, double addOffset) ;
         void parse(xml::CXMLNode & node) ;
         CArray<double,1>* getInstantData(void)  ;
Index: /XIOS/trunk/src/output/nc4_data_output.cpp
===================================================================
--- /XIOS/trunk/src/output/nc4_data_output.cpp	(revision 463)
+++ /XIOS/trunk/src/output/nc4_data_output.cpp	(revision 464)
@@ -566,7 +566,13 @@
 //          bool isCurvilinear = domain->isCurvilinear ; 
           
-         nc_type type = (!field->prec.isEmpty() &&
-                        ( field->prec.getValue() == 4))
-                        ? NC_FLOAT : NC_DOUBLE;
+         nc_type type ;
+         if (field->prec.isEmpty()) type =  NC_FLOAT ;
+         else
+         {
+           if (field->prec==2) type = NC_SHORT ;
+           else if (field->prec==4)  type =  NC_FLOAT ;
+           else if (field->prec==8)   type =  NC_DOUBLE ; 
+         }
+                     
          bool wtime   = !(!field->operation.isEmpty() && field->foperation->timeType() == func::CFunctor::once);
                          
@@ -628,4 +634,12 @@
             SuperClassWriter::addAttribute
                ("valid_max", field->valid_max.getValue(), &fieldid);
+
+          if (!field->scale_factor.isEmpty())
+            SuperClassWriter::addAttribute
+               ("scale_factor", field->scale_factor.getValue(), &fieldid);
+
+           if (!field->add_offset.isEmpty())
+            SuperClassWriter::addAttribute
+               ("add_offset", field->add_offset.getValue(), &fieldid);
                                             
          SuperClassWriter::addAttribute
@@ -765,5 +779,14 @@
          if (server->intraCommRank==0) isRoot=true ;
          else isRoot=false ;
-           
+          
+         if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty())
+         {
+           double scaleFactor=1. ;
+           double addOffset=0. ;
+           if (!field->scale_factor.isEmpty()) scaleFactor=field->scale_factor ;
+           if (!field->add_offset.isEmpty()) addOffset=field->add_offset ;
+           field->scaleFactorAddOffset(scaleFactor,addOffset) ;
+         }
+            
          if (grid->hasAxis()) // 3D
          {
@@ -771,5 +794,9 @@
             CArray<double,3> field_data3D(domain->zoom_ni_srv,domain->zoom_nj_srv,axis->zoom_size) ;
             if (!field->default_value.isEmpty()) field_data3D = field->default_value ;
+
             field->outputField(field_data3D);
+
+            if (field->prec==2) field_data3D=round(field_data3D) ;
+
             switch (SuperClass::type)
            {
@@ -815,4 +842,5 @@
             if (!field->default_value.isEmpty()) field_data2D = field->default_value ;
             field->outputField(field_data2D);
+            if (field->prec==2) field_data2D=round(field_data2D) ;
             switch (SuperClass::type)
             {
