Changeset 1480
 Timestamp:
 04/13/18 10:33:54 (2 years ago)
 Location:
 XIOS/dev/XIOS_DEV_CMIP6/src/transformation
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_interpolate.cpp
r1474 r1480 912 912 } 913 913 914 if (firstPass) 915 { 916 allMissing.resize(dataOut.numElements()) ; 917 allMissing=true ; 918 } 919 914 920 for (int idx = 0; idx < nbLocalIndex; ++idx) 915 921 { 916 922 if (NumTraits<double>::isNan(*(dataInput + idx))) 917 923 { 918 flagInitial[localIndex[idx].first] = false;924 allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && true; 919 925 if (renormalize) renormalizationFactor(localIndex[idx].first)=localIndex[idx].second ; 920 926 } … … 922 928 { 923 929 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 924 flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan930 allMissing(localIndex[idx].first) = allMissing(localIndex[idx].first) && false; // Reset flag to indicate not all data source are nan 925 931 } 926 932 } 927 933 928 // If all data source are nan then data destination must be nan 934 } 935 else 936 { 929 937 for (int idx = 0; idx < nbLocalIndex; ++idx) 930 938 { 931 if (!flagInitial[localIndex[idx].first])932 dataOut(localIndex[idx].first) = defaultValue;933 }934 }935 else936 {937 for (int idx = 0; idx < nbLocalIndex; ++idx)938 {939 939 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 940 940 } … … 944 944 void CDomainAlgorithmInterpolate::updateData(CArray<double,1>& dataOut) 945 945 { 946 if (detectMissingValue && renormalize) 947 { 948 if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask) 949 // so renormalizationFactor is not initialized 950 } 951 } 952 953 } 946 if (detectMissingValue) 947 { 948 double defaultValue = std::numeric_limits<double>::quiet_NaN(); 949 size_t nbIndex=dataOut.numElements() ; 950 951 for (int idx = 0; idx < nbIndex; ++idx) 952 { 953 if (allMissing(idx)) dataOut(idx) = defaultValue; // If all data source are nan then data destination must be nan 954 } 955 956 if (renormalize) 957 { 958 if (renormalizationFactor.numElements()>0) dataOut/=renormalizationFactor ; // In some case, process doesn't received any data for interpolation (mask) 959 // so renormalizationFactor is not initialized 960 } 961 } 962 } 963 964 } 
XIOS/dev/XIOS_DEV_CMIP6/src/transformation/domain_algorithm_interpolate.hpp
r1269 r1480 55 55 private: 56 56 CArray<double,1> renormalizationFactor ; 57 CArray<bool,1> allMissing ; 57 58 bool detectMissingValue ; 58 59 bool renormalize ; 
XIOS/dev/XIOS_DEV_CMIP6/src/transformation/generic_algorithm_transformation.cpp
r1474 r1480 37 37 int nbLocalIndex = localIndex.size(); 38 38 double defaultValue = std::numeric_limits<double>::quiet_NaN(); 39 39 40 if (ignoreMissingValue) 40 41 { 42 if (firstPass) dataOut=defaultValue ; 43 41 44 for (int idx = 0; idx < nbLocalIndex; ++idx) 42 45 { 43 if (NumTraits<double>::isNan(*(dataInput + idx))) 44 { 45 flagInitial[localIndex[idx].first] = false; 46 } 47 else 48 { 49 dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 50 flagInitial[localIndex[idx].first] = true; // Reset flag to indicate not all data source are nan 51 } 52 } 53 54 // If all data source are nan then data destination must be nan 55 for (int idx = 0; idx < nbLocalIndex; ++idx) 56 { 57 if (!flagInitial[localIndex[idx].first]) 58 dataOut(localIndex[idx].first) = defaultValue; 59 } 46 if (! NumTraits<double>::isNan(*(dataInput + idx))) 47 { 48 if (flagInitial[localIndex[idx].first]) dataOut(localIndex[idx].first) = *(dataInput + idx) * localIndex[idx].second; 49 else dataOut(localIndex[idx].first) += *(dataInput + idx) * localIndex[idx].second; 50 flagInitial[localIndex[idx].first] = false; // Reset flag to indicate not all data source are nan 51 } 52 } 53 60 54 } 61 55 else
Note: See TracChangeset
for help on using the changeset viewer.