Commit 6d3dba6e493f81a8c5535e69569d9febeacd948d
1 parent
f9df9e2a
Exists in
master
and in
83 other branches
Fix bug with fillValue and shift (#8061)
Showing
4 changed files
with
41 additions
and
21 deletions
Show diff stats
src/Info/ParamInfo.cc
... | ... | @@ -24,29 +24,30 @@ std::ostream& operator<<(std::ostream& out, const ParamInfo& pi){ |
24 | 24 | |
25 | 25 | out << "[ParamInfo]" << std::endl; |
26 | 26 | out << "{"<<std::endl; |
27 | - out << " _id = " << pi._id << std::endl; | |
28 | - out << " _name = " << pi._name << std::endl; | |
29 | - out << " _short_name = " << pi._short_name << std::endl; | |
30 | - out << " _components = " << pi._components << std::endl; | |
31 | - out << " _units = " << pi._units << std::endl; | |
32 | - out << " _coordinates_system = " << pi._coordinates_system << std::endl; | |
33 | - out << " _tensor_order = " << pi._tensor_order << std::endl; | |
34 | - out << " _si_conversion = " << pi._si_conversion << std::endl; | |
35 | - out << " _fill_value = " << pi._fill_value << std::endl; | |
36 | - out << " _ucd = " << pi._ucd << std::endl; | |
37 | - out << " _statusDef = "; | |
27 | + out << " _id = " << pi._id << std::endl; | |
28 | + out << " _name = " << pi._name << std::endl; | |
29 | + out << " _short_name = " << pi._short_name << std::endl; | |
30 | + out << " _components = " << pi._components << std::endl; | |
31 | + out << " _units = " << pi._units << std::endl; | |
32 | + out << " _coordinates_system = " << pi._coordinates_system << std::endl; | |
33 | + out << " _tensor_order = " << pi._tensor_order << std::endl; | |
34 | + out << " _si_conversion = " << pi._si_conversion << std::endl; | |
35 | + out << " _original_fill_value = " << pi._original_fill_value << std::endl; | |
36 | + out << " _fill_value = " << pi._fill_value << std::endl; | |
37 | + out << " _ucd = " << pi._ucd << std::endl; | |
38 | + out << " _statusDef = "; | |
38 | 39 | for (auto status : pi._statusDef) |
39 | 40 | out << "[" << status.getMinValue() << |
40 | 41 | ", " << status.getMaxValue() << |
41 | 42 | ", " << status.getName() << "]," << std::endl; |
42 | - out << " _processInfo = " << pi._processInfo << std::endl; | |
43 | - out << " _processDesc = " << pi._processDesc << std::endl; | |
44 | - out << " _linkedParamList = "; | |
43 | + out << " _processInfo = " << pi._processInfo << std::endl; | |
44 | + out << " _processDesc = " << pi._processDesc << std::endl; | |
45 | + out << " _linkedParamList = "; | |
45 | 46 | for (auto linkedParam : pi._linkedParamList) |
46 | 47 | out << linkedParam << ", "; |
47 | 48 | out << std::endl; |
48 | - out << " _dataset_id = " << pi._dataset_id << std::endl; | |
49 | - out << " _instrument_id = " << pi._dataset_id << std::endl; | |
49 | + out << " _dataset_id = " << pi._dataset_id << std::endl; | |
50 | + out << " _instrument_id = " << pi._dataset_id << std::endl; | |
50 | 51 | out << "}" << std::endl; |
51 | 52 | return out; |
52 | 53 | } | ... | ... |
src/Info/ParamInfo.hh
... | ... | @@ -60,6 +60,7 @@ public: |
60 | 60 | _coordinates_system(""), |
61 | 61 | _tensor_order(0), |
62 | 62 | _si_conversion(""), |
63 | + _original_fill_value(NAN), | |
63 | 64 | _fill_value(NAN), |
64 | 65 | _ucd(""), |
65 | 66 | _statusDef(), |
... | ... | @@ -74,7 +75,7 @@ public: |
74 | 75 | _short_name(info._short_name), _components(info._components), |
75 | 76 | _units(info._units), _coordinates_system(info._coordinates_system), |
76 | 77 | _tensor_order(info._tensor_order), _si_conversion(info._si_conversion), |
77 | - _tables(info._tables), _fill_value(info._fill_value), _ucd(info._ucd), _statusDef(info._statusDef), | |
78 | + _tables(info._tables), _original_fill_value(info._original_fill_value), _fill_value(info._fill_value), _ucd(info._ucd), _statusDef(info._statusDef), | |
78 | 79 | _processInfo(info._processInfo), _processDesc(info._processDesc), _linkedParamList(info._linkedParamList), |
79 | 80 | _dataset_id(info._dataset_id), _instrument_id(info._instrument_id) |
80 | 81 | {} |
... | ... | @@ -265,6 +266,20 @@ public: |
265 | 266 | } |
266 | 267 | |
267 | 268 | /* |
269 | + * @brief Get parameter original fill value (fill value defined in the parameter XML file) | |
270 | + */ | |
271 | + double getOriginalFillValue() const { | |
272 | + return _original_fill_value; | |
273 | + } | |
274 | + | |
275 | + /* | |
276 | + * @brief Set parameter original fill value (fill value defined in the parameter XML file) | |
277 | + */ | |
278 | + void setOriginalFillValue(double fillValue) { | |
279 | + _original_fill_value = fillValue; | |
280 | + } | |
281 | + | |
282 | + /* | |
268 | 283 | * @brief Get parameter fill value |
269 | 284 | */ |
270 | 285 | double getFillValue() const { |
... | ... | @@ -400,6 +415,7 @@ protected: |
400 | 415 | int _tensor_order; |
401 | 416 | std::string _si_conversion; |
402 | 417 | std::map<int, boost::shared_ptr<ParamTable>> _tables; |
418 | + double _original_fill_value; | |
403 | 419 | double _fill_value; |
404 | 420 | std::string _ucd; |
405 | 421 | std::vector<StatusInfo> _statusDef; | ... | ... |
src/Info/ParamParser.cc
... | ... | @@ -124,8 +124,11 @@ class ParamFillValueNode : public NodeCfg |
124 | 124 | public: |
125 | 125 | void proceed(xmlNodePtr pNode,const AMDA::Parameters::CfgContext& pContext) { |
126 | 126 | ParamInfo* pParamInfo = pContext.get<ParamInfo*>(); |
127 | - if (pNode->children && pNode->children->content && (pNode->children->content [0] != '\0')) | |
128 | - pParamInfo->setFillValue(atof((const char*)pNode->children->content)); | |
127 | + if (pNode->children && pNode->children->content && (pNode->children->content [0] != '\0')) { | |
128 | + double fillVal = atof((const char*)pNode->children->content); | |
129 | + pParamInfo->setFillValue(fillVal); | |
130 | + pParamInfo->setOriginalFillValue(fillVal); | |
131 | + } | |
129 | 132 | } |
130 | 133 | }; |
131 | 134 | ... | ... |
src/ParamGetImpl/DDServerInterface/ParamGetDDBase.cc
... | ... | @@ -58,9 +58,9 @@ namespace AMDA { |
58 | 58 | _pusher = _vi->getParamPusher(_parName, _maxDim1Size, _maxDim2Size, _maxDim3Size, _dim3Num, _dim3CutIndex, _minSumIndex, _maxSumIndex); |
59 | 59 | //Param info |
60 | 60 | AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(_parameter.getInfoId(),true); |
61 | - if ((paramInfo != nullptr) && (isnan(_pusher->getFillValue())) && (!isnan(paramInfo->getFillValue()))) | |
61 | + if ((paramInfo != nullptr) && (isnan(_pusher->getFillValue())) && (!isnan(paramInfo->getOriginalFillValue()))) | |
62 | 62 | { |
63 | - _pusher->setFillValue(paramInfo->getFillValue()); | |
63 | + _pusher->setFillValue(paramInfo->getOriginalFillValue()); | |
64 | 64 | } |
65 | 65 | _paramData = ParamDataSPtr(_pusher->_paramData); |
66 | 66 | _paramData->setMinSampling(_vi->getMinSampling()); | ... | ... |