-
Dear GROOPS Team, The content of this message concerns a possible error presented after investigating a possible removal of identical points when using the “GriddedDataConcatenate” function. As an example, I will use two simple “GriddedData” files (each of which contains just 2 data lines) which I try to concatenate into a single “GriddedData” file with the “GriddedDataConcatenate” function after specifying the value of the “removeDuplicates” config element as “keepFirst”, “keepLast” and “< none >”; for all three cases the value of the “sortPoints” config element is set to “no”. Given that the two data files contain no identical points within the specified margin [1e-5], all three cases described above would be expected to yield the same result. However, the output files of the first two cases differ from the one of the last case (no removal of duplicates); specifically, their data lines are the ones included in the two input files, but they are not in the correct order as it is the case with the output file of the last case. Why are the data lines of the concatenated file mixed up and not in the correct order when the “removeDuplicates” config element is enabled? Attached you will find the “RemoveDuplicatesGriddedDataConcatenate.zip” file which includes the two “GriddedData” files [“GT_1.txt” & “GT_2.txt”] and the “RemoveDuplicatesGriddedDataConcatenate.xml” file which is a simple script I created just containing the three cases described above using the “GriddedDataConcatenate” program. Thank you very much in advance for your time and looking forward to your feedback. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello Grigorios, Removing duplicates is implemented by sorting all points and then removing identical subsequent points. Therefore, whenever you use keepFirst or keepLast, the concatenated points are sorted, no matter if you set sortPoints to yes or no. You can check the code here: groops/source/programs/griddedData/griddedDataConcatenate.cpp Lines 147 to 176 in bd72c26 If you check your logs, it should state "sort points". However, it does not seem like this behavior is documented anywhere, so maybe the program's documentation could be improved. If you need to retain the order of the points for some reason, this would require a different implementation of the removal algorithm, Best regards, |
Beta Was this translation helpful? Give feedback.
Hello Grigorios,
Removing duplicates is implemented by sorting all points and then removing identical subsequent points. Therefore, whenever you use keepFirst or keepLast, the concatenated points are sorted, no matter if you set sortPoints to yes or no.
You can check the code here:
groops/source/programs/griddedData/griddedDataConcatenate.cpp
Lines 147 to 176 in bd72c26