Ignore:
Timestamp:
09/25/17 12:19:49 (7 years ago)
Author:
oabramkina
Message:

Adding a check on field attributes. For now it only concerns freq_op and freq_offset.
It is done so to avoid changing its values on client after the attributes have already been sent to servers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp

    r1272 r1278  
    11441144               << "An operation must be defined for field \"" << getId() << "\"."); 
    11451145 
    1146        if (freq_op.isEmpty()) 
    1147 //         freq_op.setValue(TimeStep); 
    1148          freq_op.setValue(NoneDu); 
    1149        if (freq_offset.isEmpty()) 
    1150          freq_offset.setValue(NoneDu); 
    1151  
    11521146       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    11531147        
     
    11561150                                                                             freq_op, freq_offset, outFreq, 
    11571151                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
     1152 
    11581153       instantDataFilter->connectOutput(temporalFilter, 0); 
    11591154 
     
    11871182               << "An operation must be defined for field \"" << getId() << "\"."); 
    11881183 
    1189        if (freq_op.isEmpty()) freq_op.setValue(TimeStep); 
    1190        if (freq_offset.isEmpty()) freq_offset.setValue(NoneDu); 
    1191  
    11921184       const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 
    11931185 
     
    11961188                                                                             freq_op, freq_offset, outFreq, 
    11971189                                                                             detectMissingValues, detectMissingValues ? default_value : 0.0)); 
     1190 
    11981191       selfReferenceFilter->connectOutput(temporalFilter, 0); 
    11991192       return temporalFilter ; 
     
    15661559 
    15671560   /*! 
     1561    * Check on freq_off and freq_op attributes. 
     1562    */ 
     1563   void CField::checkAttributes(void) 
     1564   { 
     1565     if (freq_op.isEmpty()) 
     1566     { 
     1567       if (!freq_offset.isEmpty()) 
     1568         ERROR("CField::checkAttributes(void)", 
     1569               << "[ id = " << this->getId() << " , context = '" << CObjectFactory::GetCurrentContextId() << " ] " 
     1570               << "Attribute freq_offset cannot be defined if attribute freq_op is not defined. " 
     1571               << "Please define freq_op.") 
     1572       else 
     1573       { 
     1574         CContext* context = CContext::getCurrent(); 
     1575         if (operation.getValue()=="instant") 
     1576         { 
     1577           freq_op.setValue(file->output_freq.getValue()); 
     1578           freq_offset.setValue(file->output_freq.getValue() - TimeStep); 
     1579         } 
     1580         else 
     1581         { 
     1582           freq_op.setValue(TimeStep); 
     1583           freq_op.setValue(NoneDu); 
     1584         } 
     1585       } 
     1586     } 
     1587     else 
     1588     { 
     1589       if (freq_offset.isEmpty()) 
     1590         freq_op.setValue(NoneDu); 
     1591     } 
     1592   } 
     1593 
     1594   /*! 
    15681595    * Returns string arithmetic expression associated to the field. 
    15691596    * \return if content is defined return content string, otherwise, if "expr" attribute is defined, return expr string. 
Note: See TracChangeset for help on using the changeset viewer.