Changeset 1315
- Timestamp:
- 10/25/17 16:36:53 (7 years ago)
- Location:
- XIOS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp
r1308 r1315 942 942 if (!isReferenceSolvedAndTransformed) solveAllEnabledFieldsAndTransform(); 943 943 944 checkAttributes(); 945 944 946 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 945 947 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); … … 1012 1014 // Check if the data is to be read from a file 1013 1015 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 1014 instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, 1015 freq_offset.isEmpty() ? NoneDu : freq_offset, 1016 true, 1016 instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 1017 1017 detectMissingValues, defaultValue)); 1018 1018 else // The data might be passed from the model … … 1092 1092 if (!selfReferenceFilter) 1093 1093 { 1094 checkAttributes(); 1095 1094 1096 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1095 1097 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); … … 1098 1100 { 1099 1101 if (!serverSourceFilter) 1100 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, 1101 freq_offset.isEmpty() ? NoneDu : freq_offset, 1102 true, 1102 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true, freq_offset, true, 1103 1103 detectMissingValues, defaultValue)); 1104 1104 … … 1146 1146 << "An operation must be defined for field \"" << getId() << "\"."); 1147 1147 1148 checkAttributes(); 1149 1148 1150 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1149 checkAttributes() ;1150 1151 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1151 1152 CContext::getCurrent()->getCalendar()->getInitDate(), … … 1184 1185 << "An operation must be defined for field \"" << getId() << "\"."); 1185 1186 1187 checkAttributes(); 1188 1186 1189 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 1187 checkAttributes() ;1188 1190 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 1189 1191 CContext::getCurrent()->getCalendar()->getInitDate(), … … 1576 1578 void CField::checkAttributes(void) 1577 1579 { 1580 bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; 1581 if (isFieldRead && operation.getValue() != "instant") 1582 ERROR("void CField::checkAttributes(void)", 1583 << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl 1584 << "Currently only \"instant\" is supported for fields read from file.") 1585 1578 1586 if (freq_op.isEmpty()) 1579 1587 { 1580 if (operation.getValue() =="instant")1588 if (operation.getValue() == "instant") 1581 1589 freq_op.setValue(file->output_freq.getValue()); 1582 1590 else … … 1584 1592 } 1585 1593 if (freq_offset.isEmpty()) 1586 freq_offset.setValue( freq_op.getValue()-TimeStep);1594 freq_offset.setValue(isFieldRead ? NoneDu : (freq_op.getValue() - TimeStep)); 1587 1595 } 1588 1596 -
XIOS/trunk/src/node/field.cpp
r1307 r1315 788 788 if (!areAllReferenceSolved) solveAllReferenceEnabledField(false); 789 789 790 checkAttributes(); 791 790 792 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 791 793 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); … … 821 823 // Check if the data is to be read from a file 822 824 else if (file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read) 823 instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 824 freq_offset.isEmpty() ? NoneDu : freq_offset, 825 true, 825 instantDataFilter = serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, freq_offset, true, 826 826 detectMissingValues, defaultValue)); 827 827 else // The data might be passed from the model … … 900 900 if (!selfReferenceFilter) 901 901 { 902 checkAttributes(); 903 902 904 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 903 905 const double defaultValue = detectMissingValues ? default_value : (!default_value.isEmpty() ? default_value : 0.0); … … 906 908 { 907 909 if (!serverSourceFilter) 908 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, 909 freq_offset.isEmpty() ? NoneDu : freq_offset, 910 true, 910 serverSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, freq_offset, true, 911 911 detectMissingValues, defaultValue)); 912 912 … … 954 954 << "An operation must be defined for field \"" << getId() << "\"."); 955 955 956 checkAttributes(); 957 956 958 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 957 checkAttributes() ;958 959 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 959 960 CContext::getCurrent()->getCalendar()->getInitDate(), … … 991 992 << "An operation must be defined for field \"" << getId() << "\"."); 992 993 994 checkAttributes(); 995 993 996 const bool detectMissingValues = (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value == true); 994 checkAttributes();995 997 boost::shared_ptr<CTemporalFilter> temporalFilter(new CTemporalFilter(gc, operation, 996 998 CContext::getCurrent()->getCalendar()->getInitDate(), … … 1442 1444 void CField::checkAttributes(void) 1443 1445 { 1446 bool isFieldRead = file && !file->mode.isEmpty() && file->mode == CFile::mode_attr::read; 1447 if (isFieldRead && operation.getValue() != "instant") 1448 ERROR("void CField::checkAttributes(void)", 1449 << "Unsupported operation for field '" << getFieldOutputName() << "'." << std::endl 1450 << "Currently only \"instant\" is supported for fields read from file.") 1451 1444 1452 if (freq_op.isEmpty()) 1445 1453 { 1446 if (operation.getValue() =="instant")1454 if (operation.getValue() == "instant") 1447 1455 freq_op.setValue(file->output_freq.getValue()); 1448 1456 else … … 1450 1458 } 1451 1459 if (freq_offset.isEmpty()) 1452 freq_offset.setValue( freq_op.getValue()-TimeStep);1460 freq_offset.setValue(isFieldRead ? NoneDu : (freq_op.getValue() - TimeStep)); 1453 1461 } 1454 1462
Note: See TracChangeset
for help on using the changeset viewer.